Swoole is another effort to bring event-driven async features to PHP:

Swoole is an event-driven, asynchronous & concurrent networking communication framework with higher performance written only in C for PHP.

While I’m not sure about using this as an application server for PHP ( I have mixed feelings about PHP app servers in general ), I do like their TCP server example:

[sourcecode lang=”php”]
$serv = new swoole_server("", 9501);
‘worker_num’ => 8,
‘daemonize’ => true,
$serv->on(‘connect’, function ($serv, $fd){
echo "Client:Connect.n";
$serv->on(‘receive’, function ($serv, $fd, $from_id, $data) {
$serv->send($fd, ‘Swoole: ‘.$data);
$serv->on(‘close’, function ($serv, $fd) {
echo "Client: Close.n";

Leave a Reply

Your email address will not be published. Required fields are marked *