phpdic/swoole-auto-restart
Composer 安装命令:
composer require phpdic/swoole-auto-restart
包简介
swoole development, automatically restarting the service after modifying the code.
README 文档
README
.
说明
此扩展包用于,swoole开发,修改代码后自动重启服务
依赖PHP扩展
- swoole
pecl install swoole
- inotify,此扩展为php文件监听扩展,安装命令如下
pecl install inotify
安装
$ composer require phpdic/swoole-auto-restart -vvv
用法
1.在你的项目根目建立一个php脚本,如:swoole-auto-start.php,内容如下:
require './vendor/autoload.php'; //启动服务的脚本,修改成你自己的 $startServiceCommand='/usr/bin/php easyswoole start'; $a = new \Phpdic\SwooleAutoRestart\swooleAutoRestart(__DIR__, $startServiceCommand); $a->listen();
2.执行你刚刚创建的这个脚本
/usr/bin/php swoole-auto-start.php
说明
swooleAutoRestart构造函数注解
/** * swooleAutoRestart constructor. * @param string $rootDir 需要监听的项目根目录 * @param string $startServerCommand 启动swoole服务器的命令 * @param array $notCheckDir 配置不需要监听的目录 * @param int $restartInterval 重启间隔 * @param bool $showDetail 是否展示详细信息 */ public function __construct(string $rootDir,string $startServerCommand,array $notCheckDir=[],$restartInterval=1000,$showDetail=false) {
notCheckDir参数可以配置不需要监听的目录,例如,我的项目是laravel框架,设置如下:
$notCheckDir=['/bootstrap','/storage','/tests']
Contributing
You can contribute in one of three ways:
- File bug reports using the issue tracker.
- Answer questions or fix bugs on the issue tracker.
- Contribute new features or update the wiki.
The code contribution process is not very formal. You just need to make sure that you follow the PSR-0, PSR-1, and PSR-2 coding guidelines. Any new code contributions must be accompanied by unit tests where applicable.
License
MIT
phpdic/swoole-auto-restart 适用场景与选型建议
phpdic/swoole-auto-restart 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 2.81k 次下载、GitHub Stars 达 22, 最近一次更新时间为 2018 年 12 月 14 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 phpdic/swoole-auto-restart 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 phpdic/swoole-auto-restart 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 2.81k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 23
- 点击次数: 22
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-12-14