joanhey/adapterman
Composer 安装命令:
composer require joanhey/adapterman
包简介
Use any framework and application with Workerman.
关键字:
README 文档
README
Faster, More Scalable Apps with Serverless Capabilities
Run nearly any PHP application seamlessly using the async, event-driven Workerman without modifying a single line of code in your framework or app.
If your application or framework follows a Front Controller pattern, there’s a 99% chance it will work out of the box.
Minimum requirements:
- PHP 8.0 (or higher)
- Adapterman 0.7 (requires PHP 8.1)
Currently Compatible With:
- Symfony
- Laravel
- CakePHP
- Yii2
- Slim
- KumbiaPHP
- ThinkPHP
- Leaf
- FlightPHP
- Wolff
- Phpixie
- ... (Your app could be next!)
More frameworks and applications are being tested continuously, all without requiring code changes.
Experience enhanced performance and scalability effortlessly.
NEW !!! Workerman shared nothing mode
We started to test it. Experimental still.
Each request is independent and load the .php file, like with PHP-FPM. Using the same .php files.
| Framework | JSON | 1-query | Multiple queries | Fortunes | Updates | Plaintext |
|---|---|---|---|---|---|---|
| php php-fpm | 187,747 | 97,658 | 12,784 | 79,309 | 2,010 | 195,283 |
| php workerman | 822,930 | 134,475 | 15,648 | 124,923 | 4,683 | 1,161,016 |
Performance bench Worker mode
Results from Techempower benchmark. Without touch a line of code.
Follow https://twitter.com/adaptermanphp for more updates.
Symfony 6
| Fw | Plaintext | Json | Single query | Multiple query | Updates | Fortunes |
|---|---|---|---|---|---|---|
| Symfony | 38,231 | 37,557 | 12,578 | 10,741 | 3,420 | 10,741 |
| Symfony Workerman | 210,796 | 197,059 | 107,050 | 13,401 | 4,062 | 71,092 |
Laravel 8
With full ORM.
| Fw | Plaintext | Json | Single query | Multiple query | Updates | Fortunes |
|---|---|---|---|---|---|---|
| Laravel | 14,799 | 14,770 | 9,263 | 3,247 | 1,452 | 8,354 |
| Laravel Roadrunner | 482 | 478 | 474 | 375 | 359 | 472 |
| Laravel Swoole | 38,824 | 37,439 | 21,687 | 3,958 | 1,588 | 16,035 |
| Laravel Laravel s | 54,617 | 49,372 | 23,677 | 2,917 | 1,255 | 16,696 |
| Laravel Workerman | 103,004 | 99,891 | 46,001 | 5,828 | 1,666 | 27,158 |
Slim with Workerman
| Framework | Plaintext | JSON | 1-query | 20-query | Updates | Fortunes |
|---|---|---|---|---|---|---|
| Slim 4 | 35,251 | 38,305 | 34,272 | 12,579 | 2,097 | 32,634 |
| Slim 4 Workerman | 134,531 | 129,393 | 81,889 | 15,803 | 2,456 | 73,212 |
| Slim 4 Workerman pgsql * | 102,926 | 19,637 | 14,875 | 92,752 |
- Without ORM and db class optimized for Workerman
Symfony demo with Workerman
Symfony initialization 0ms and half the time per request.
Grabacion_microsoft-edge-dev_20221023170450.mp4
Installation
composer require joanhey/adapterman
Automatically install Workerman too.
Tree
Where to create the files (server.php and start.php)
.
├── app(dir)
├── public(dir)
├── vendor(dir)
├── composer.json
├── server.php
└── start.php
Server
server.php
<?php require_once __DIR__ . '/vendor/autoload.php'; use Adapterman\Adapterman; use Workerman\Worker; Adapterman::init(); $http_worker = new Worker('http://0.0.0.0:8080'); $http_worker->count = 8; $http_worker->name = 'AdapterMan'; $http_worker->onWorkerStart = static function () { //init(); require __DIR__.'/start.php'; }; $http_worker->onMessage = static function ($connection, $request) { $connection->send(run()); }; Worker::runAll();
Front Controller
It's different for any fw and app.
We are creating recipes for popular apps and frameworks.
Recommended start.php and leave index.php in public.
We can run the app with Workerman and with php-fpm at the same time.
Available commands in workerman
To run your app.
php server.php start
php server.php start -d
php server.php status
php server.php status -d
php server.php connections
php server.php stop
php server.php stop -g
php server.php restart
php server.php reload
php server.php reload -g
Workerman documentation: https://manual.workerman.net/doc/en/
You can also select a diferent cli php.ini directly:
php -c cli-php.ini server.php start
Help with session issues
I have been using this library internally for over two years to run legacy applications with Workerman. Initially, we developed it primarily for APIs and microservices, so session handling wasn't a key focus during testing. As a result, the session functionality may not be as thoroughly tested or optimized as other features.
If you encounter any issues related to sessions, please let us know so we can investigate and improve compatibility.
Login progress
It's working with Symfony and Laravel
joanhey/adapterman 适用场景与选型建议
joanhey/adapterman 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 60.18k 次下载、GitHub Stars 达 856, 最近一次更新时间为 2020 年 08 月 29 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「php」 「event」 「workerman」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 joanhey/adapterman 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 joanhey/adapterman 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 joanhey/adapterman 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Cubex Framework with Workerman
Workerman extension for Ubiquity framework
Symfony bundle for broadway/broadway.
This is an Event Emitter equivalent to Node.js' Event Emitter.
Publish / Subscribe / Event Manager
A PHP library to implement the observer pattern
统计信息
- 总下载量: 60.18k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 858
- 点击次数: 13
- 依赖项目数: 2
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-08-29








