Linux安装
composer create-project hyperf/hyperf-skeleton
修改启动端口:config\autoload\server.php
启动
php bin/hyperf.php start
安装热更新
composer require hyperf/watcher --dev
删除 ./composer.lock 文件
更新composer.json文件:
在require下增加"hyperf/watcher": "~2.0.0"
执行composer更新命令
composer update
热更新启动
php bin/hyperf.php server:watch
url请求 http://192.168.1.212:9701/
安装FindDriver驱动热更
修改或创建 config/autoload/watcher.php 文件
<?php
declare(strict_types=1);
/**
* This file is part of Hyperf.
*
* @link https://www.hyperf.io
* @document https://hyperf.wiki
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
use Hyperf\Watcher\Driver\ScanFileDriver;
use Hyperf\Watcher\Driver\FswatchDriver;
use Hyperf\Watcher\Driver\FindDriver;
return [
'driver' => FindDriver::class,
'bin' => 'php',
'watch' => [
'dir' => ['app', 'config', 'vendor'],
'file' => ['.env'],
'scan_interval' => 2000,
],
];