Using PHP with WebSocket

Is it possible to use PHP with WebSocket? Let's figure out
16 October 2017   1284

Unfortuantelly, PHP is not designed to work with WebSocket. You can connect it, but your code will be full of while (true) and fsock_open . And you have to have access to the shell to run the WS-server with php-cgi. 

You need to choose a language that supports threads / asynchronous communication. Now on the top is Node.js. In addition, better use dedicated libraries to support older browsers, etc. If you want to create one-to-all communication (eg chat, broadcast messaging), go one step further and use one of the Bayeuximplementations, for example: Faye.

The mod_proxy_wstunnel extension adds an extra layer to the WS server. Depending on the configuration, it can support DDoS, queue, load-balancing, local port swapping, and https support. But better use this for nginx.

Websockets are events, and PHP is poorly managed with it.

PhpStorm 2018.2 to be Available

The new version brought improved support for PHP, web technologies and tools
30 July 2018   255

The second major update of the PhpStorm development environment by JetBrains was released under the number 2018.2. The new version brought improved support for PHP, web technologies and tools, as well as general performance improvements and fixes.

Key features of PhpStorm 2018.2:

PHP Language

  • Custom postfix completion templates
  • FQCN completion
  • Structural Search and Replace for PHP
  • Improved SQL Injections
  • The new presentation for Quick Documentation
  • Jumping outside closing bracket/quote with Tab
  • New Inspections and Quick Fixes

PHP Refactorings

  • Move Instance Method Refactoring
  • New Add @method tag quick fix for Undefined method
  • Add method quick fix now inserts parameter type hints

PHP Tools

  • Simple CodeSniffer/MessDetector setup
  • PHPUnit composite configuration

HTTP Client

  • Support for environment variables in the request body
  • Support for POST request body formatting

The previous update to the IDE PhpStorm was released in the spring of 2018. In version 2018.1, developers focused on improving code handling and testing.