☄️ PHP CLI mode development framework, supports Swoole, WorkerMan, FPM, CLI-Serve

Overview

OpenMix 出品:https://openmix.org



MixPHP

Mix PHP

中文 | English

MixPHP 是一个 PHP 命令行模式开发框架;基于 Vega 驱动的 HTTP 可以同时支持 Swoole、WorkerMan、FPM、CLI-Server 生态,并且可以无缝切换;V3 是一个高度解耦的版本,整体代码基于多个独立的模块构建,即便用户不使用我们的脚手架,也可以使用这些独立模块,并且全部模块都支持原生开发。例如:你可以只使用 mix/vega 来搭配 laravel orm 使用;可以在任意环境中使用 mix/database 和 mix/redis;可以使用 mix/grpc 原生代码编写 gRPC;所有的模块你可以像搭积木一样随意组合。

独立模块

核心模块全部可独立使用,并且都支持原生代码开发。

  • mix/vega PHP 编写的 CLI 模式 HTTP 网络框架,支持 Swoole、WorkerMan、FPM、CLI-Server
  • mix/database 可在各种环境中使用的轻量数据库,支持 FPM、CLI、Swoole、WorkerMan,可选的连接池 (协程)
  • mix/redis 可在各种环境中使用的 PHP Redis,支持 FPM、CLI、Swoole、WorkerMan,可选的连接池 (协程)
  • mix/redis-subscriber 基于 Swoole 协程的 Redis 原生协议订阅库
  • mix/grpc 基于 Swoole 协程的 PHP gRPC 库,包含 protoc 代码生成器、服务器、客户端
  • mix/websocket 基于 Swoole 协程的 PHP WebSocket 服务器与客户端
  • mix/cli PHP 命令行交互指挥官
  • mix/worker-pool 基于 Swoole 的协程池、工作池库
  • mix/validator 基于 PSR-7 的验证库
  • mix/event 基于 PSR-14 标准的事件调度库
  • mix/init 帮助执行类的静态初始化,通常用于预加载单例

服务器

支持多种服务器驱动,并且可以无缝切换。

开发文档

快速开始

提供了现成的脚手架,快速创建项目,立即产出。

composer create-project --prefer-dist mix/cli-skeleton cli
composer create-project --prefer-dist mix/api-skeleton api
composer create-project --prefer-dist mix/web-skeleton web
composer create-project --prefer-dist mix/websocket-skeleton websocket
composer create-project --prefer-dist mix/grpc-skeleton grpc

性能测试

techempower-benchmark.png

web-frameworks-benchmark.png

推荐阅读

技术交流

知乎:https://www.zhihu.com/people/onanying
官方QQ群:284806582, 825122875 敲门暗号:phper

Golang 框架

OpenMix 同时还有 Golang 生态的框架

License

Apache License Version 2.0, http://www.apache.org/licenses/

Comments
  • Adds prefix support for redis-subscriber

    Adds prefix support for redis-subscriber

    This PR is adds prefix support to compatible with redis connection.

    $sub = new \Mix\Redis\Subscriber\Subscriber('127.0.0.1', 6379, '', 5, 'my_prefix:');
    
    opened by huangdijia 11
  • websocket demo 有问题。redis  sub 没法取消已经关闭的连接

    websocket demo 有问题。redis sub 没法取消已经关闭的连接

    如题: 如果用redis,sub/pub. 客户端主动断开。 但是redis的sub 还存在该连接客户端, 到时候pub 时候, 错误日志会 NOTICE swFactoryProcess_finish (ERROR 1005): connection[fd=2] does not exists。 or NOTICE swFactoryProcess_finish (ERROR 1004): send 70 byte failed, because connection[fd=31] is closed.

    然后再redis-cli publish 返回的数量,也是发现这些关闭的还在订阅 频道

    question 
    opened by chenhui1221 9
  • 数据量较多时,json_decode可能会失败

    数据量较多时,json_decode可能会失败

    Server         Name:      mix-httpd
    System         Name:      linux
    PHP            Version:   7.2.17
    Swoole         Version:   4.4.16
    Framework      Version:   2.1.9
    Listen         Addr:      0.0.0.0
    Listen         Port:      7777
    

    需求:json_decode能正确处理数据 实际:json_decode处理json中大量数据(大概20多条)时有可能会失败,导致报non-object错误,具体表现为前两次请求中运行成功,第三次开始失败,一旦失败过一次后续都无法成功

    [notice] 2020-03-31 13:39:12.613 <3255> Trying to get property 'health_data' of non-object
    [code] 8 [type] Mix\Console\Exception\ErrorException
    [file] in /vagrant/mixtest/app/Http/Controllers/BandController.php on line 83
     #0 Mix\Console\Error->appError(8, 'Trying to get p...', '/vagrant/mixtes...', 83, Array) in /vagrant/mixtest/app/Http/Controllers/BandController.php on line 83
     #1 [internal function]: App\Http\Controllers\BandController->uploadData(Object(Mix\Http\Message\ServerRequest), Object(Mix\Http\Message\Response))
     #2 call_user_func(Array, Object(Mix\Http\Message\ServerRequest), Object(Mix\Http\Message\Response)) in /vagrant/mixtest/app/Http/Commands/StartCommand.php on line 131
     #3 App\Http\Commands\StartCommand->handle(Object(Mix\Http\Message\ServerRequest), Object(Mix\Http\Message\Response)) in /vagrant/mixtest/app/Http/Commands/StartCommand.php on line 85
     #4 [internal function]: App\Http\Commands\StartCommand->App\Http\Commands\{closure}(Object(Mix\Http\Message\ServerRequest), Object(Mix\Http\Message\Response))
     #5 call_user_func(Object(Closure), Object(Mix\Http\Message\ServerRequest), Object(Mix\Http\Message\Response)) in /vagrant/mixtest/vendor/mix/http-server/src/Server.php on line 107
     #6 [internal function]: Mix\Http\Server\Server->Mix\Http\Server\{closure}(Object(Swoole\Http\Request), Object(Swoole\Http\Response))
     #7 {main}
    

    无法确定是swoole还是框架或者是我使用上的问题,同样的请求、同样的代码换用slim框架后一切正常。

    opened by peinhu 7
  • 安装了SwooleFor

    安装了SwooleFor

    启动php swoolefor.phar -e "php /data/wwwroot/www.lua.qifeng/bin/mix-httpd start -c /data/wwwroot/www.lua.qifeng/http/config/httpd.php" --ext=php,json,ini 监控失败

    opened by sjfxy 7
  • 新版本性能严重下降

    新版本性能严重下降

    查询某张表100条数据 版本2.1.9:

    [vagrant@bogon ~]$ wrk -c 100 -d 10s -t 10 --latency http://localhost:7779/mixphp/test
    Running 10s test @ http://localhost:7779/mixphp/test
      10 threads and 100 connections
      Thread Stats   Avg      Stdev     Max   +/- Stdev
        Latency   571.52us   64.56us   3.82ms   95.05%
        Req/Sec     1.72k   244.30     1.80k    98.04%
      Latency Distribution
         50%  556.00us
         75%  561.00us
         90%  607.00us
         99%  800.00us
      17535 requests in 10.06s, 279.12MB read
      Socket errors: connect 0, read 0, write 0, timeout 1
    Requests/sec:   1743.07
    Transfer/sec:     27.75MB
    
    

    版本2.2.5:

    [vagrant@bogon /]$ wrk -c 100 -d 10s -t 10 --latency http://localhost:9501/test
    Running 10s test @ http://localhost:9501/test
      10 threads and 100 connections
      Thread Stats   Avg      Stdev     Max   +/- Stdev
        Latency    99.97ms    8.92ms 205.44ms   86.62%
        Req/Sec   100.33      9.62   148.00     71.21%
      Latency Distribution
         50%   99.06ms
         75%  102.44ms
         90%  106.69ms
         99%  135.73ms
      10029 requests in 10.09s, 159.32MB read
    Requests/sec:    993.62
    Transfer/sec:     15.78MB
    
    

    可以看到性能严重下降,是什么原因?代码是复制过去的,基本没改。

    invalid 
    opened by peinhu 6
  • Coroutine中同时使用Channel和Database pool导致出错

    Coroutine中同时使用Channel和Database pool导致出错

    • os: alpine3.9
    • php_version: 7.3.13
    • swoole_version: 4.5.2
    • mix_version: 2.2.11

    bug来源:

    官方CoroutineCommand demo

    bug描述:

    并发使用连接池协程的数量大于8时,channel将提前被销毁导致无法写入

    复现路径:

    修改官方demo中的main,将并发数i增加到8以上

    示例:

    • 修改/mix/app/Console/Commands/CoroutineCommand.php
    public function main()
    {
        $time = time();
        $chan = new Channel();
        xdefer(function () use ($chan) {
            $chan->close();
        });
        for ($i = 0; $i < 10; $i++) {
            xgo([$this, 'foo'], $chan);
        }
        for ($i = 0; $i < 10; $i++) {
            $result = $chan->pop();
            if(false===$result) {
                echo "i:".$i." chan_err_code:".$chan->errCode."\n";
            }
    
        }
        println(sprintf('Time: %ds', (time() - $time)));
    }
    
    • 执行php bin/mix.php co结果如下:

    图片

    opened by liushzhql 5
  • Use user sessions with multiple servers?

    Use user sessions with multiple servers?

    Hi everyone, a question can mix-php handle user sessions through multiple servers (front end ) connected to one database server ?

    I am thinking of that laravel can handle it since one can store sessions in the database, is this possible to do the same with mix-php ?

    Regards

    opened by zilveer 5
  • APP_DEBUG设为false依然会输出错误信息

    APP_DEBUG设为false依然会输出错误信息

    Server         Name:      mix-httpd
    System         Name:      linux
    PHP            Version:   7.2.17
    Swoole         Version:   4.4.16
    Framework      Version:   2.1.9
    Listen         Addr:      0.0.0.0
    Listen         Port:      7777
    

    需求:APP_DEBUG设为false时不显示错误,或不显示错误详情 实际:APP_DEBUG设为false依然会输出错误,相关数据库字段和框架信息遭到泄露

    SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '11' for key 'bands_mac_unique'
    PDOException code 23000
    /vagrant/mixtest/vendor/mix/database/src/AbstractConnection.php line 345
    
    #0 /vagrant/mixtest/vendor/mix/database/src/AbstractConnection.php(345): PDOStatement->execute()
    #1 [internal function]: Mix\Database\AbstractConnection->execute()
    #2 /vagrant/mixtest/vendor/mix/database/src/Persistent/Connection.php(92): call_user_func_array('parent::execute', Array)
    #3 /vagrant/mixtest/vendor/mix/database/src/Connection.php(30): Mix\Database\Persistent\Connection->call('execute', Array)
    #4 /vagrant/mixtest/vendor/mix/database/src/Persistent/Connection.php(69): Mix\Database\Connection->call('execute')
    #5 /vagrant/mixtest/app/Http/Models/BandModel.php(44): Mix\Database\Persistent\Connection->execute()
    #6 /vagrant/mixtest/app/Http/Controllers/BandController.php(66): App\Http\Models\BandModel->add(Object(App\Http\Forms\BandForm))
    #7 [internal function]: App\Http\Controllers\BandController->register(Object(Mix\Http\Message\ServerRequest), Object(Mix\Http\Message\Response))
    #8 /vagrant/mixtest/app/Http/Commands/StartCommand.php(123): call_user_func(Array, Object(Mix\Http\Message\ServerRequest), Object(Mix\Http\Message\Response))
    #9 /vagrant/mixtest/app/Http/Commands/StartCommand.php(84): App\Http\Commands\StartCommand->handle(Object(Mix\Http\Message\ServerRequest), Object(Mix\Http\Message\Response))
    #10 [internal function]: App\Http\Commands\StartCommand->App\Http\Commands\{closure}(Object(Mix\Http\Message\ServerRequest), Object(Mix\Http\Message\Response))
    #11 /vagrant/mixtest/vendor/mix/http-server/src/Server.php(107): call_user_func(Object(Closure), Object(Mix\Http\Message\ServerRequest), Object(Mix\Http\Message\Response))
    #12 [internal function]: Mix\Http\Server\Server->Mix\Http\Server\{closure}(Object(Swoole\Http\Request), Object(Swoole\Http\Response))
    #13 {main}
    
    MixPHP V2.1 —— Single-threaded coroutine PHP framework
    

    看了下好像debug参数只在日志里用到了,是不是框架无法屏蔽错误,只能自己try...catch处理?

    opened by peinhu 4
  • 2.1.0-RC版本,获取 access_token 的接口 出错。

    2.1.0-RC版本,获取 access_token 的接口 出错。

    2.1.0-RC版本

    $time = time();
    $payload     = [
      "iss" => "http://example.org", // 签发人
      'iat' => $time, // 签发时间
      'exp' => $time + 7200, // 过期时间
      'uid' => $uid
     ];
    $auth        = context()->get('auth');
    $access_token= $auth->createToken($payload);
    

    出现以下错误,这是什么原因造成的呢?如果解决?

    > Too few arguments to function Mix\Auth\JWT::__construct(), 0 passed in ***//vendor/mix/bean/src/BeanDefinition.php on line 156 and exactly 1 expected
    > [code] 0 [type] ArgumentCountError
    > [file] ***/vendor/mix/auth/src/JWT.php [line] 53
    > [trace] #0 ***/vendor/mix/bean/src/BeanDefinition.php(156): Mix\Auth\JWT->__construct()
    > #1 ***/vendor/mix/bean/src/BeanFactoryTrait.php(79): Mix\Bean\BeanDefinition->newInstance(Array)
    > #2 ***/vendor/mix/bean/src/BeanInjector.php(41): Mix\Bean\ApplicationContext->getBean('Mix\\Auth\\JWT')
    > #3 ***/vendor/mix/bean/src/BeanDefinition.php(149): Mix\Bean\BeanInjector::build(Object(Mix\Bean\ApplicationContext), Array)
    > #4 ***/vendor/mix/bean/src/BeanFactoryTrait.php(74): Mix\Bean\BeanDefinition->newInstance(Array)
    > #5 ***/vendor/mix/bean/src/ApplicationContext.php(36): Mix\Bean\ApplicationContext-getBean('auth')
    > #6***/app/src/Http/Controllers/LoginController.php(47): Mix\Bean\ApplicationContext->get('auth')
    > #7 [internal function]: App\Http\Controllers\LoginController->passwd(Object(Mix\Http\Message\ServerRequest), Object(Mix\Http\Message\Response))
    > #8 ***/app/src/Http/Commands/StartCommand.php(130): call_user_func(Array, Object(Mix\Http\Message\ServerRequest), Object(Mix\Http\Message\Response))
    > #9 ***/app/src/Http/Commands/StartCommand.php(91): App\Http\Commands\StartCommand->handle(Object(Mix\Http\Message\ServerRequest), Object(Mix\Http\Message\Response))
    > #10 [internal function]: App\Http\Commands\StartCommand->App\Http\Commands\{closure}(Object(Mix\Http\Message\ServerRequest), Object(Mix\Http\Message\Response))
    > #11 ***/vendor/mix/http-server/src/HttpServer.php(95): call_user_func(Object(Closure), Object(Mix\Http\Message\ServerRequest), Object(Mix\Http\Message\Response))
    > #12 [internal function]: Mix\Http\Server\HttpServer->Mix\Http\Server\{closure}(Object(Swoole\Http\Request), Object(Swoole\Http\Response))
    > #13 {main}
    

    看了一下BeanDefinition.php文件156行代码

    $object or $object = new $class();  
    

    JWT.php文件的代码是

    public function __construct(array $config)
    
    opened by kingze 4
  • 当使用左进程进行调用$worker->send($messages);出现错误

    当使用左进程进行调用$worker->send($messages);出现错误

    当数组大小为1时,不会出打印出错误 如果数组大小为2是或者更多,会出现错误 备注:数组内部为对象: 打印错误为: [2019-02-11 23:48:39 @19603.0] ERROR swMsgQueue_push(:104): msgsnd(65536, 2468, 1) failed. Error: Invalid argument[22].

    打印位置BaseQueue.php push方法 当数组长度为1时,序列化的内容为

    a:1:{i:0;O:16:"MQ\Model\Message":9:{s:16:"*receiptHandle";s:93:"2F630CC85E5C3D4EAC69389B9775013B-OSAxNTQ5OTAwMTIwOTU5IDMwMDAwMCA3IDAgaHotc2hhcmUyLTAzIDEgOQ==";s:14:"*publishTime";s:13:"1549900120949";s:18:"*nextConsumeTime";s:13
    :"1549900420959";s:19:"*firstConsumeTime";s:13:"1549900120959";s:16:"*consumedTimes";s:1:"1";s:9:"messageId";s:32:"2F630CC85E5C3D4EAC69389B9775013B";s:14:"messageBodyMD5";s:32:"8D7B3DF974943E802F6C4D70D2293D3B";s:11:"messageBody";s:738:"{"db"
    :{"uid":"100033","app_id":"100270","url":"http:\/\/www.kancloud.cn\/manual\/thinkphp5_1\/354102","title":"\u4eca\u5929\u8fd8\u6ca1\u6709\u7b7e\u5230\u54e6\uff0c\u4e0d\u8981\u5fd8\u8bb0\u4e86\u554a","description":"\u6cd5\u5e08\u6253\u53d1\u65a
    f\u8482\u82ac","tid":"100028","push_description":"\u8fd9\u91cc\u63a8\u9001\u63cf\u8ff0"},"push":{"uid":"100033","app_id":"100270","url":"http:\/\/www.kancloud.cn\/manual\/thinkphp5_1\/354102","title":"\u5de5\u4f5c\u901a\u77e5:\u6cb3\u5357\u77
    01\u7b2c\u4e00\u4eba\u6c11\u533b\u9662","description":"[\u7b7e\u5230]\u4eca\u5929\u8fd8\u6ca1\u6709\u7b7e\u5230\u54e6\uff0c\u4e0d\u8981\u5fd8\u8bb0\u4e86\u554a","tid":"100028","push_description":"\u8fd9\u91cc\u63a8\u9001\u63cf\u8ff0"},"versio
    n":"1"}";s:10:"messageTag";N;}}
    

    当数组长度为2时,序列化的内容为

    string(2468) "a:2:{i:0;O:16:"MQ\Model\Message":9:{s:16:"*receiptHandle";s:93:"2F630B0D5D5C3D4EAC69389B8EFC009F-MTAgMTU0OTkwMDEyMDA4NyAzMDAwMDAgMyAwIGh6LXNoYXJlMi0wNCAzIDEw";s:14:"*publishTime";s:13:"1549900118780";s:18:"*nextConsumeTime";s:13
    :"1549900420087";s:19:"*firstConsumeTime";s:13:"1549900120087";s:16:"*consumedTimes";s:1:"1";s:9:"messageId";s:32:"2F630B0D5D5C3D4EAC69389B8EFC009F";s:14:"messageBodyMD5";s:32:"8D7B3DF974943E802F6C4D70D2293D3B";s:11:"messageBody";s:738:"{"db"
    :{"uid":"100033","app_id":"100270","url":"http:\/\/www.kancloud.cn\/manual\/thinkphp5_1\/354102","title":"\u4eca\u5929\u8fd8\u6ca1\u6709\u7b7e\u5230\u54e6\uff0c\u4e0d\u8981\u5fd8\u8bb0\u4e86\u554a","description":"\u6cd5\u5e08\u6253\u53d1\u65a
    f\u8482\u82ac","tid":"100028","push_description":"\u8fd9\u91cc\u63a8\u9001\u63cf\u8ff0"},"push":{"uid":"100033","app_id":"100270","url":"http:\/\/www.kancloud.cn\/manual\/thinkphp5_1\/354102","title":"\u5de5\u4f5c\u901a\u77e5:\u6cb3\u5357\u77
    01\u7b2c\u4e00\u4eba\u6c11\u533b\u9662","description":"[\u7b7e\u5230]\u4eca\u5929\u8fd8\u6ca1\u6709\u7b7e\u5230\u54e6\uff0c\u4e0d\u8981\u5fd8\u8bb0\u4e86\u554a","tid":"100028","push_description":"\u8fd9\u91cc\u63a8\u9001\u63cf\u8ff0"},"versio
    n":"1"}";s:10:"messageTag";N;}i:1;O:16:"MQ\Model\Message":9:{s:16:"*receiptHandle";s:93:"792BCECC6D5A3D4EAC69389B92570138-MTAgMTU0OTkwMDEyMDA4NyAzMDAwMDAgMyAwIGh6LXNoYXJlMi0wNCAwIDEw";s:14:"*publishTime";s:13:"1549900119639";s:18:"*nextConsum
    eTime";s:13:"1549900420087";s:19:"*firstConsumeTime";s:13:"1549900120087";s:16:"*consumedTimes";s:1:"1";s:9:"messageId";s:32:"792BCECC6D5A3D4EAC69389B92570138";s:14:"messageBodyMD5";s:32:"8D7B3DF974943E802F6C4D70D2293D3B";s:11:"messageBody";s
    :738:"{"db":{"uid":"100033","app_id":"100270","url":"http:\/\/www.kancloud.cn\/manual\/thinkphp5_1\/354102","title":"\u4eca\u5929\u8fd8\u6ca1\u6709\u7b7e\u5230\u54e6\uff0c\u4e0d\u8981\u5fd8\u8bb0\u4e86\u554a","description":"\u6cd5\u5e08\u6253
    \u53d1\u65af\u8482\u82ac","tid":"100028","push_description":"\u8fd9\u91cc\u63a8\u9001\u63cf\u8ff0"},"push":{"uid":"100033","app_id":"100270","url":"http:\/\/www.kancloud.cn\/manual\/thinkphp5_1\/354102","title":"\u5de5\u4f5c\u901a\u77e5:\u6cb
    3\u5357\u7701\u7b2c\u4e00\u4eba\u6c11\u533b\u9662","description":"[\u7b7e\u5230]\u4eca\u5929\u8fd8\u6ca1\u6709\u7b7e\u5230\u54e6\uff0c\u4e0d\u8981\u5fd8\u8bb0\u4e86\u554a","tid":"100028","push_description":"\u8fd9\u91cc\u63a8\u9001\u63cf\u8ff
    0"},"version":"1"}";s:10:"messageTag";N;}}"
    
    opened by Shandawei 4
  • 重启服务报错,提示找不到Swoole\Process文件

    重启服务报错,提示找不到Swoole\Process文件

    PHP Fatal error: Uncaught Error: Class 'Swoole\Process' not found in /www/wwwroot/xxx.com/mixphp/vendor/mixstart/mixphp-framework/src/helpers/ProcessHelper.php:40 Stack trace: #0 /www/wwwroot/xxx.com/mixphp/vendor/mixstart/mixphp-framework/src/helpers/ProcessHelper.php(31): mix\helpers\ProcessHelper::kill('17120', 0) #1 /www/wwwroot/xxx.com/mixphp/vendor/mixstart/mixphp-framework/src/helpers/ProcessHelper.php(64): mix\helpers\ProcessHelper::isRunning('17120') #2 /www/wwwroot/xxx.com/mixphp/apps/httpd/commands/ServiceCommand.php(66): mix\helpers\ProcessHelper::readPidFile('/var/run/mix-ht...') #3 /www/wwwroot/xxx.com/mixphp/apps/httpd/commands/ServiceCommand.php(83): apps\httpd\commands\ServiceCommand->actionStop() #4 /www/wwwroot/xxx.com/mixphp/vendor/mixstart/mixphp-framework/src/console/Application.php(82): apps\httpd\commands\ServiceCommand->actionRestart() #5 /www/wwwroot/xxx.com/mixphp/vendor/mixstart/mixphp-framework/src/console/Application.php in /www/wwwroot/xxx.com/mixphp/vendor/mixstart/mixphp-framework/src/helpers/ProcessHelper.php on line 40

    opened by zhanyangqi 4
  • 如何正确的提交 PR

    如何正确的提交 PR

    https://github.com/mix-php 的子仓库都是由 https://github.com/mix-php/mix 项目的 src 目录内的源码同步过去的,因此:

    • 提交代码需要 fork https://github.com/mix-php/mix
    • 然后修改 src 对应子目录的源码
    • 然后提交 PR 到 https://github.com/mix-php/mix

    这样你的贡献就会出现在 mix 主仓库中,同时也会出现在子仓库

    opened by onanying 0
Releases(v3.0.27)
  • v3.0.27(Apr 15, 2022)

  • v3.0.21(Sep 2, 2021)

    Fixed

    • 解决 phpfpm, cli-server 模式的路由兼容问题
    • 解决 database 在 pgsql 的兼容性

    Improve

    • 统一 header 大小写
    • 增加 grpc 客户端的断线重连机制
    Source code(tar.gz)
    Source code(zip)
  • v3.0.17(Aug 5, 2021)

  • v3.0.16(Jul 28, 2021)

  • v3.0.10(Jul 24, 2021)

  • v3.0.7(Jul 22, 2021)

    V3 基于 Vega 驱动的 HTTP 可以同时支持 Swoole、WorkerMan 两大生态,并且可以无缝切换;V3 是一个高度解耦的版本,整体代码基于多个独立的模块构建,即便用户不使用我们的脚手架,也可以使用这些独立模块,并且全部模块都支持原生开发。例如:你可以只使用 mix/vega 来搭配 laravel orm 使用;可以在任意环境中使用 mix/database 和 mix/redis;可以使用 mix/grpc 原生代码编写 gRPC;所有的模块你可以像搭积木一样随意组合。

    Source code(tar.gz)
    Source code(zip)
  • v2.2.17(Dec 14, 2020)

    Improved

    • mix/database insert 方法扩展支持自定义关键字
    • mix/http-server fileServer 方法扩展支持 $stripPrefix
    • mix/object-pool 增加对死锁的异常抛出

    Fixed

    • mix/view 修复 layout 为空的错误
    Source code(tar.gz)
    Source code(zip)
  • v2.2.16(Oct 28, 2020)

  • v2.2.15(Oct 20, 2020)

    Added

    • mix/guzzle 增加 elasticsearch-php 支持

    Improved

    • mix/redis-subscribe 移除多余的依赖,优化重复关闭
    • mix/worker-pool 优化工作池
    Source code(tar.gz)
    Source code(zip)
  • v2.2.14(Sep 30, 2020)

    Added

    • mix/grpc 扩展通过 grpc-status, grpc-message 传递异常信息

    Fixed

    • mix/guzzle 修复 fopen 概率性异常问题
    • mix/http-message 解决 swoole 概率性出现 files 存在,但是 file 内无数据的情况
    • mix/database 解决 beginTransaction 时异常断开重连处理
    Source code(tar.gz)
    Source code(zip)
  • v2.2.13(Sep 11, 2020)

  • v2.2.12(Sep 5, 2020)

  • v2.2.11(Aug 10, 2020)

    Added

    • mix/database 增加 lockForUpdate、sharedLock 方法

    Fixed

    • mix/database 修复 prepare bindParam bindValue false 的处理
    • mix/console 修复 Exception 事件调度失败的问题
    • mix/console、mix/runtime 修复 handleException 获取固定依赖名称导致的问题
    Source code(tar.gz)
    Source code(zip)
  • v2.2.9(Jul 30, 2020)

    Added

    • mix/database 增加 QueryBuilder::value 方法
    • mix/object-pool 增加 maxLifetime、waitTimeout 配置

    Improved

    • mix/database 优化为安装即 hook 无需配置,扩展 fopen 的 hook
    • mix/database 扩展 where 首个批量条件括号的功能
    • mix/object-pool 参数 maxActive 修改为 maxOpen

    Fixed

    • mix/runtime 修复 Select 执行异常
    • mix/database 修复断线重连后的执行异常
    Source code(tar.gz)
    Source code(zip)
  • v2.2.7(Jul 15, 2020)

    Added

    • 增加 mix/runtime 替代 mix/concurrent mix/context,该库还提供了大量 golang 风格的基础设施
    • 增加 mix/worker-pool 替代原有的协程池
    • 增加 mix/monolog 日志单文件输出功能,类似 beego log

    Improved

    • 修改 mix/pool 为 mix/object-pool
    • 增加 mix/fast-route 可从文件加载路由
    • 优化 mix/event 事件调度的性能
    • 修改 mix/console 的协程配置
    • 修改 mix/cache mix/session handler 的类路径
    Source code(tar.gz)
    Source code(zip)
  • v2.2.5(Jun 9, 2020)

    Added

    • 增加 mix/fast-route 替代 mix/route
    • 增加 mix/http-server 静态文件处理功能,类似 golang 风格
    • 增加 mix/monolog 具有代码行数日志信息,类似 beego log
    • 增加 mix/micro-server 接口定义库

    Improved

    • 优化 mix/grpc、mix/json-rpc、mix/http-server 实现 mix/micro-server
    • 修改 mix/micro-route 为接口定义库,移除之前的 mix/route 继承
    • 优化 mix/micro-etc 实现 mix/micro-server、mix/micro-route
    Source code(tar.gz)
    Source code(zip)
  • v2.2.4(May 22, 2020)

    Added

    • 增加 mix/micro 与 go-micro 生态深度集成的 php 微服务开发框架
    • 增加 mix/grpc 类库,包含 protoc 代码生成器、服务器、客户端
    • 增加 mix/tracing、mix/tracing-zipkin 符合 opentracing 标准的调用链追踪库
    • 增加 mix/micro-hystrix 微服务熔断器
    • 增加 mix/micro-etcd 基于 Etcd 的服务注册中心、配置中心
    • 增加 mix/monolog 取代之前自主研发的日志库,并扩展了控制台打印的功能

    Improved

    • 强化 mix/json-rpc 支持微服务调用
    • 修改 mix/database、mix/redis、mix/sync-invoke 的连接池为内置,使用更加简单
    Source code(tar.gz)
    Source code(zip)
  • v2.1.15(Mar 12, 2020)

    本次更新主要是为了和即将推出的微服务开发统一骨架代码,在 SyncInvoke JsonRpc 两个模块有不兼容改动,大家根据 https://www.kancloud.cn/onanying/mixphp2-1/1555270 升级旧骨架代码。

    • mix/mix-skeleton http 模块拆分为 Api/Web 两个模块
    • mix/mix-skeleton http 由原来的通过 $server->handle() 处理请求,修改为 $server->start($this->route) 通过路由类执行
    • mix/route 增加 HandlerInterface 实现,同时增加服务注册功能
    • mix/http-message ServerRequest->getHeaders() 方法返回值由 string[] 修改为 string[][]
    • mix/redis-subscribe 优化消息处理太慢导致的阻塞问题
    • mix/database mix/redis 增加默认拨号器,无需用户自行定义,可直接依赖注入修改参数
    Source code(tar.gz)
    Source code(zip)
  • v2.1.12(Feb 26, 2020)

    • mix/bean mix/console 废弃 FileSystemApplicationContext,修改为覆盖
    • mix/server mix/websocket 优化 send 异常文案,修复 ConnectionManager->count() 异常
    • mix/console 增加 commandPath 字段,扩展文件夹加载命令配置
    • mix/mix-skeleton 调整骨架目录结构
    Source code(tar.gz)
    Source code(zip)
  • v2.1.11(Feb 14, 2020)

  • v2.1.10(Feb 6, 2020)

    • mix/mix 移除子模块,将子模块代码合并到主库,通过分片提交的方式同步代码到各子库。
    • mix/helper 修复 randomAlphanumeric 方法 php7.4 兼容。
    • mix/database 优化异常 where 从直接忽略修改为抛出异常。
    Source code(tar.gz)
    Source code(zip)
  • v2.1.9(Jan 15, 2020)

    • mix/pool 优化全部 discard 的情况
    • mix/redis-subscribe 修改为构造函数连接
    • mix/sync-invoke 命名空间修改 Sync\Invoke => SyncInvoke,增加一层 Client 封装
    • mix/bean 增加 FileSystemApplicationContext 扩展 beans 文件夹支持
    • mix/console 增加 beanPath 属性,扩展文件夹支持,Flag 参数大小写判断
    • mix/http-server 扩展 jsonrpc 支持
    • mix/json-rpc 增加 jsonrpc
    • mix/server shutdown 优化
    • mix/log 常用错误类型合并为一个文件,固定毫秒为3位
    Source code(tar.gz)
    Source code(zip)
  • v2.1.7(Jan 6, 2020)

    • mix/console 修复 Flag 参数包含 = 号的问题,移除命令默认 -h 参数,增加 context->load() 提前装载所有单例
    • mix/bean 增加 load 方法可提前装载所有单例
    • mix/route 扩展控制器传入构造参数
    • mix/mix-skeleton 扩展控制器传入构造参数,增加 hassankhan/config 配置库
    Source code(tar.gz)
    Source code(zip)
  • v2.1.6(Dec 27, 2019)

  • v2.1.5(Dec 20, 2019)

    • mix/pool 增加 ConnectionDiscardEvent 事件,用于获取丢弃的连接数据,修复 max actives 限制问题
    • mix/cache 修复连接处理错误
    • mix/console 修改 event 依赖为 PSR
    • mix/http-message 扩展 application/json 类型自动解析
    • mix/log 新增 add 方法,可动态追加 handler
    • mix/server 兼容 swoole >= 4.4.13 socket 修改成了 protected,MacOS 兼容处理
    • mix/http-server MacOS 兼容处理
    • mix/sync-invoke MacOS 兼容处理
    • mix/websocket MacOS 兼容处理
    Source code(tar.gz)
    Source code(zip)
  • v2.1.4(Dec 17, 2019)

  • v2.1.3(Dec 13, 2019)

    • mix/console 移除 app->config() 方法,异常打印可支持 IDE 链接到文件位置
    • mix/redis mix/database 抛出未知异常时自动丢弃,使用户无法归还到池
    • mix/pool 修复 discard 一直为 false 的问题
    • mix/bean 修改为当注入对象属性不存在时抛出异常
    Source code(tar.gz)
    Source code(zip)
  • v2.1.1(Dec 11, 2019)

    • mix/console 增加 event 调度 CommandBeforeExecuteEvent 事件,用来处理协程中无法 fork 导致的 MacOS Daemon 失败问题 (#3005)
    • mix/helper 增加 Mac 下协程中 fork 将抛出异常
    • mix/database ExecuteEvent 事件修改名称为 ExecutedEvent
    • mix/redis ExecuteEvent 事件修改名称为 CalledEvent
    Source code(tar.gz)
    Source code(zip)
  • v2.1.0(Dec 5, 2019)

    • 增加 sync-invoke 组件与 sync:start 模块,解决协程中调用阻塞函数的问题。
    • 优化 mix/database 保留关键字的兼容处理。
    • 修复 mix/auth 依赖注入问题。
    • 修复 mix/session cookie 失效问题。
    Source code(tar.gz)
    Source code(zip)
  • v2.1.0-RC2(Nov 1, 2019)

    • 增加 mix/redis-subscribe 库,ws模块订阅修改为使用该库,可用更精简的代码在协程中安全使用订阅。
    • http/ws/tcp/udp 都增加 -r/--reuse-port 参数,可多开端口复用,解决多 CPU 利用的问题。
    • 移除 mix/udp-server 库,移动到骨架中。
    • 优化所有 server 的连接错误为抛出异常。
    • mix/redis、mix/database 库关闭连接修改为 close。
    • mix/database 库扩展 queryOne/queryAll 可指定返回类型。
    Source code(tar.gz)
    Source code(zip)
Owner
Mix PHP
OpenMix 开源组织研发的新一代 PHP 高性能框架生态
Mix PHP
PHP Kafka client is used in PHP-FPM and Swoole. PHP Kafka client supports 50 APIs, which might be one that supports the most message types ever.

longlang/phpkafka Introduction English | 简体中文 PHP Kafka client is used in PHP-FPM and Swoole. The communication protocol is based on the JSON file in

Swoole Project 235 Dec 31, 2022
一个极简高性能php框架,支持[swoole | php-fpm ]环境

One - 一个极简高性能php框架,支持[swoole | php-fpm ]环境 快 - 即使在php-fpm下也能1ms内响应请求 简单 - 让你重点关心用one做什么,而不是怎么用one 灵活 - 各个组件松耦合,可以灵活搭配使用,使用方法保持一致 原生sql可以和模型关系with搭配使用,

vic 862 Jan 1, 2023
swoole,easyswoole,swoole framework

EasySwoole - A High Performance Swoole Framework EasySwoole is a distributed, persistent memory PHP framework based on the Swoole extension. It was cr

null 4.6k Jan 2, 2023
Multi-process coroutine edition Swoole spider !! Learn about Swoole's network programming and the use of its related APIs

swoole_spider php bin/spider // Just do it !! Cache use Swoole\Table; use App\Table\Cache; $table = new Table(1<<20); // capacity size $table->column

null 3 Apr 22, 2021
A easy way to install your basic yii projetc, we have encrypt database password in phpfile, my class with alot funtions to help you encrypt and decrypt and our swoole server install just run ./yii swoole/start and be happy!

Yii 2 Basic Project Template with swoole and Modules Yii 2 Basic Project Template is a skeleton Yii 2 application best for rapidly creating small proj

null 3 Apr 11, 2022
swoole and golang ipc, use goroutine complete swoole coroutine

swoole and golang ipc demo swoole process module exec go excutable file as sider car, use goroutine complete swoole coroutine hub.php <?php require '

null 2 Apr 17, 2022
High performance HTTP Service Framework for PHP based on Workerman.

webman High performance HTTP Service Framework for PHP based on Workerman. Manual https://www.workerman.net/doc/webman Benchmarks https://www.techempo

walkor 1.3k Jan 2, 2023
A server side alternative implementation of socket.io in PHP based on workerman.

phpsocket.io A server side alternative implementation of socket.io in PHP based on Workerman. Notice Only support socket.io v1.3.0 or greater. This pr

walkor 2.1k Jan 6, 2023
QPM, the process management framework in PHP, the efficient toolkit for CLI development. QPM provides basic daemon functions and supervision mechanisms to simplify multi-process app dev.

QPM QPM全名是 Quick(or Q's) Process Management Framework for PHP. PHP 是强大的web开发语言,以至于大家常常忘记PHP 可以用来开发健壮的命令行(CLI)程序以至于daemon程序。 而编写daemon程序免不了与各种进程管理打交道。Q

Comos 75 Dec 21, 2021
Hyperf instant messaging program based on swoole framework

Hyperf instant messaging program based on swoole framework

null 20 Aug 12, 2022
An asynchronous event driven PHP socket framework. Supports HTTP, Websocket, SSL and other custom protocols. PHP>=5.3.

Workerman What is it Workerman is an asynchronous event-driven PHP framework with high performance to build fast and scalable network applications. Wo

walkor 10.2k Dec 31, 2022
Sunhill Framework is a simple, fast, and powerful PHP App Development Framework

Sunhill Framework is a simple, fast, and powerful PHP App Development Framework that enables you to develop more modern applications by using MVC (Model - View - Controller) pattern.

Mehmet Selcuk Batal 3 Dec 29, 2022
球球大作战(PHP+Swoole)

球球大作战 在线多人H5游戏(H5客户端, 服务端) W A S D 控制 技术栈: PHP7.4+ Swoole4.6(多进程, WebSocket, 共享内存) SpriteJS v3(2D Canvas渲染) 演示Demo 安装: 环境要求:Linux,PHP7.4+(启用Swoole拓展)

Vacant 15 May 9, 2022
🚀 Developing Rocketseat's Next Level Week (NLW#05) Application using PHP/Swoole + Hyperf

Inmana PHP ?? Developing Rocketseat 's Next Level Week (NLW#05) Application using Swoole + Hyperf. This is the app of the Elixir track. I know PHP/Swo

Leo Cavalcante 18 Jun 1, 2022
Simple live support server with PHP Swoole Websocket and Telegram API

Telgraf Simple live support server with PHP Swoole Websocket and Telegram API. Usage Server Setup Clone repository with following command. git clone h

Adem Ali Durmuş 6 Dec 30, 2022
Redis watcher for PHP-Casbin in Swoole.

Redis watcher for PHP-Casbin in Swoole Redis watcher for PHP-Casbin in Swoole , Casbin is a powerful and efficient open-source access control library.

PHP-Casbin 1 Nov 22, 2021
Socks5 proxy server written in Swoole PHP

php-socks This is a Socks5 proxy server implementation built with PHP & Swoole. To start the proxy server, clone this repo, run composer install to in

Nazmul Alam 3 Jan 23, 2022
DoraRPC is an RPC For the PHP MicroService by The Swoole

Dora RPC 简介(Introduction) Dora RPC 是一款基础于Swoole定长包头通讯协议的最精简的RPC, 用于复杂项目前后端分离,分离后项目都通过API工作可更好的跟踪、升级、维护及管理。 问题提交: Issue For complex projects separation

Chang Long Xu 468 Jan 5, 2023
PHP Coroutine HTTP client - Swoole Humanization Library

PHP Coroutine HTTP client - Swoole Humanization Library

swlib 973 Dec 17, 2022