English | 中文
EasySwoole is a distributed, persistent memory PHP framework based on the Swoole extension. It was created specifically for APIs to get rid of the performance penalties associated with process calls and file loading. EasySwoole highly encapsulates the Swoole Server and still maintains the original features of the Swoole server, supports simultaneous monitoring of HTTP, custom TCP, and UDP protocols, allowing developers to write multi-process, asynchronous, and highly available applications with minimal learning cost and effort.
<?php
namespace App\HttpController;
use EasySwoole\Http\AbstractInterface\Controller;
/**
* Class Index
* @package App\HttpController
*/
class Index extends Controller
{
public function index()
{
$this->response()->write('Hello World');
}
}
command : ab -c 100 -n 10000 http://192.168.0.11:9501/
Server Software: EasySwoole
Server Hostname: 192.168.0.11
Server Port: 9501
Document Path: /
Document Length: 21 bytes
Concurrency Level: 100
Time taken for tests: 0.652 seconds
Complete requests: 10000
Failed requests: 0
Write errors: 0
Total transferred: 1690000 bytes
HTML transferred: 210000 bytes
Requests per second: 15325.16 [#/sec] (mean)
Time per request: 9.685 [ms] (mean)
Time per request: 0.097 [ms] (mean, across all concurrent requests)
Transfer rate: 2592.05 [Kbytes/sec] received
command : ab -c 100 -n 10000 http://192.168.0.4:9501/
Server Software: EasySwoole
Server Hostname: 192.168.0.4
Server Port: 9501
Document Path: /
Document Length: 21 bytes
Concurrency Level: 100
Time taken for tests: 0.746 seconds
Complete requests: 10000
Failed requests: 0
Write errors: 0
Total transferred: 1690000 bytes
HTML transferred: 210000 bytes
Requests per second: 66935.97 [#/sec] (mean)
Time per request: 1.149 [ms] (mean)
Time per request: 0.015 [ms] (mean, across all concurrent requests)
Transfer rate: 2265.40 [Kbytes/sec] received
composer require easyswoole/easyswoole=3.7.x
php vendor/bin/easyswoole.php install
php easyswoole.php server start
docker pull easyswoolexuesi2021/easyswoole:php8.1.22-alpine3.16-swoole4.8.13
More Docker images can be viewed:Docker Hub or Git for Dockerfile
docker run --name easyswoole \
-v /workspace/project:/var/www/project \
-p 9501:9501 -it \
--privileged -u root \
--entrypoint /bin/sh \
easyswoolexuesi2021/easyswoole:php8.1.22-alpine3.16-swoole4.8.13
composer require easyswoole/easyswoole=3.7.x
php vendor/bin/easyswoole.php install
php easyswoole.php server start
QQ交流群
商业支持: