xiaodi / xiaodi-worker
Installs: 32
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 1
Open Issues: 0
Type:think-extend
Requires
- php: >=5.6.0
- topthink/framework: 5.1.*
- topthink/think-installer: ^2.0
- workerman/workerman: ^3.5
This package is auto-updated.
Last update: 2024-10-28 00:49:40 UTC
README
ThinkPHP5.1 命令行启动多个Workerman 服务
安装
composer require xiaodi/xiaodi-worker
配置
以下使用了think-worker包
application/Worker/Http.php
<?php namespace app\Worker; use think\worker\Server; class Http extends Server { protected $socket = 'http://0.0.0.0:55555'; public function onMessage($connection,$data) { $connection->send(json_encode($data)); } }
config/service.php
Http
: 服务名称 \app\Worker\Http
: 服务的具体命名空间
<?php return [ 'Http' => '\app\Worker\Http' ];
命令
参数一
服务名称
参数二
命令 如 [start|stop|reload|restart|status]
参数三
是否守护进程模式
php think service:run 参数一 参数二 参数三
启动
原生支持的命令 [start|stop|reload|restart|status]
php think service:run Http start
守护进程
php think service:run Http start -d