https://github.com/edenleung/xiaodi-worker
ThinkPHP5.1 命令行启动多个Worker
https://github.com/edenleung/xiaodi-worker
thinkphp thinkphp5 workerman
Last synced: 5 months ago
JSON representation
ThinkPHP5.1 命令行启动多个Worker
- Host: GitHub
- URL: https://github.com/edenleung/xiaodi-worker
- Owner: edenleung
- License: other
- Created: 2019-05-18T15:21:48.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2019-05-27T12:37:49.000Z (over 6 years ago)
- Last Synced: 2025-02-19T19:40:41.397Z (11 months ago)
- Topics: thinkphp, thinkphp5, workerman
- Language: PHP
- Size: 34.2 KB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# xiaodi-worker
ThinkPHP5.1 命令行启动多个Workerman 服务
[](https://packagist.org/packages/xiaodi/xiaodi-worker)
[](https://packagist.org/packages/xiaodi/xiaodi-worker)
[](https://packagist.org/packages/xiaodi/xiaodi-worker)
[](https://github.com/996icu/996.ICU/blob/master/LICENSE)
[](https://packagist.org/packages/xiaodi/xiaodi-worker)
[](https://packagist.org/packages/xiaodi/xiaodi-worker)
### 安装
```
composer require xiaodi/xiaodi-worker
```
### 配置
以下使用了[think-worker包](https://github.com/top-think/think-worker/tree/2.0)
`application/Worker/Http.php`
```php
send(json_encode($data));
}
}
```
`config/service.php`
`Http`: 服务名称 `\app\Worker\Http`: 服务的具体命名空间
```php
'\app\Worker\Http'
];
```
### 命令
`参数一` 服务名称
`参数二` 命令 如 [start|stop|reload|restart|status]
`参数三` 是否守护进程模式
`php think service:run 参数一 参数二 参数三`
### 启动
原生支持的命令 [start|stop|reload|restart|status]
```sh
php think service:run Http start
```
### 守护进程
```sh
php think service:run Http start -d
```