PHP code example of phpdic / swoole-auto-restart

1. Go to this page and download the library: Download phpdic/swoole-auto-restart library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

phpdic / swoole-auto-restart example snippets




//启动服务的脚本,修改成你自己的
$startServiceCommand='/usr/bin/php easyswoole start';

$a = new \Phpdic\SwooleAutoRestart\swooleAutoRestart(__DIR__, $startServiceCommand);
$a->listen();

 /**
     * 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=['/bootstrap','/storage','/tests']
bash
/usr/bin/php swoole-auto-start.php