connor/swoole-glue

SwooleGlue - Swoole和各种框架集成

1.0.0 2018-07-02 12:21 UTC

This package is not auto-updated.

Last update: 2024-09-21 14:38:53 UTC


README

服务器端集成swoole的插件,方便集成到现有的框架中,实现项目的无缝迁移,新一代LAMP开发模式

//安装配置
php bin/SwooleGlue.php install 

实现SwooleGlue\Component\PServerlet类,在这里做业务处理,并在配置文件中配置实现后的 PServerlet类


启动server
php bin/SwooleGlue.php start 

HTTP响应头问题解决

在fpm模式下通常通过header(), setcookie()等函数来设置response的header信息,由于我们使用cli模式运行php,常规的header_list()取不到header信息了,需要对接header(), setcookie()进行封装替换

nginx + SwooleGlue 配置

server {
    listen  80;
    server_name  _;
    root  /var/www/test;

    location / {
        if (!-e $request_filename){
            proxy_pass http://127.0.0.1:9501;
        }
    }


fastcgi协议解析

fastcgi协议解析引入了 lisachenko/protocol-fcgi 1.1.1 版本, 参考https://github.com/lisachenko/protocol-fcgi/tree/1.1.1