• Installation and deployment of sw-x framework


    Official website address:Sw-x framework – PHP swoolex framework focusing on high-performance and convenient development Sw-x depends on the PHP spool extension, so we need to install the spool extension before running sw-x. ###1. Install swoole4 eight wget http://pecl.php.net/get/swoole-4.8.0.tgz tar -zxvf swoole-4.8.0.tgz cd swoole-4.8.0 phpize #Note: the PHP installation directory here should be changed to the […]

  • swoole


    use Swoole\Redis\Server; //use Swoole\Coroutine\Redis; $http = new swoole_http_server(“”, 9501); global $redis; $redis = new Redis(); $redis->connect(‘’, 6379); $val = $redis->auth(‘foobared’); $http->set(array( ‘reactor_num’ => 2, //reactor thread num ‘worker_num’ => 4, //worker process num ‘backlog’ => 128, //listen backlog ‘max_request’ => 50, ‘dispatch_mode’ => 1, //’daemonize’ => 1, )); $http->on(‘WorkerStart’, function ($serv, $worker_id){ global $argv; // […]

  • PHP uses spool to write a simple echo server example


    This article describes a simple echo server written by PHP using spool. The details are as follows: server.php The code is as follows: <?php class EchoServer { protected $serv = null; public function __construct() { $this->serv = new swoole_server(‘’, 8888); //Configuration parameters $this->serv->set(array( ‘worker_num’ => 4, ‘daemonize’ => 0, )); //Register callback function $this->serv->on(‘start’, array($this, […]

  • Case study on asynchronous processing of time-consuming tasks using task process in PHP spool


    This paper introduces the asynchronous processing of time-consuming tasks using task process in PHP spool. The details are as follows: As we know, there are two major processes in spool, namely, master master process and manager management process. In the master main process, there will be a main reactor thread and multiple reactor threads, which […]

  • HTTP in PHP spool_ Case analysis of server configuration and usage


    In this paper, an example is given to show how to use HTTP in PHP spool_ The configuration and usage of server. The details are as follows: A spool is provided for us in spool_ http_ Server class, convenient for us to handle HTTP requests. However, its support for HTTP protocol is not complete, so […]

  • Example of creating and using subprocess in process module of PHP spool


    This paper introduces the creation and operation of sub process in the process module of PHP spool. The details are as follows: Swoole provides us with a process management module process to replace the pcntl extension of PHP, which is convenient for us to create processes, manage processes, and communicate between processes. Spool provides two […]

  • Official release of Swoft 2.0.6


    What is soft? Swoft is a PHP microservice collaboration framework based on swoole extension. Like go, swoft has built-in co process network server and common co process clients, which are memory resident and do not rely on traditional php-fpm. There are cooperative operation modes similar to go language, flexible annotation similar to spring cloud framework, […]

  • Thinkphp5.0 framework combined with swoole development to realize websocket online chat case explanation


    In this paper, an example is given to illustrate the implementation of websocket online chat case based on thinkphp5.0 framework and swoole. To share with you for your reference, as follows: To use swoole in ThinkPHP, you need to install the think swoole composer package, provided that the system has installed the swoole PECL extension […]

  • Detailed explanation of swoole’s task case of asynchronous delivery


    An example of this paper describes the implementation of asynchronous delivery task in swoole. To share with you for your reference, as follows: [usage scenario] Swoolle’s task module can be used to do some asynchronous slow tasks and time-consuming scenarios. For example, webim sends broadcast and email. After these tasks are left to the task […]

  • Example of implementing real-time asynchronous task queue with PHP extended swoole


    The example of this paper describes how to extend swoole in PHP to realize real-time asynchronous task queue. To share with you for your reference, as follows: If want to send 100 mail, for circulates 100 times, the user rises directly, what break a website! But in fact, we are likely to have more than […]

  • PHP process: go + Chan + defer


    Swoole4byPHPLanguage provides powerfulCSPCo programming mode. The bottom layer provides3Key words, can easily achieve all kinds of functions. Swoole4ProvidedPHP AssociationGrammar fromGolangIn this directionGODevelopment team Tribute PHP+SwooleThe process can work withGolangWell complemented.GolangStatic language, rigorous and powerful, with good performance,PHP+Swoole: dynamic language, flexible and easy to use This article is based onSwoole-4.2.9andPHP-7.2.9Edition Key word go: create a process […]

  • Using docker / docker compose to deploy software applications


    Swoft The first high-performance PHP full stack framework based on swoole native orchestration in the new era, built-in orchestration network server and commonly used orchestration client, resident in memory, independent of traditional php-fpm, fully asynchronous non blocking IO implementation, similar to synchronous client writing to achieve asynchronous client use, no complex asynchronous callback, no tedious […]