快速开始
https://hyperf.wiki/3.0/#/
composer config -g repo.packagist composer https://mirrors.aliyun.com/composer #阿里云
composer config -g repos.packagist composer https://mirrors.tencent.com/composer #腾讯云
composer create-project hyperf/hyperf-skeleton #基于 Swoole 驱动,仅可运行于 Linux 和 Mac 环境下
composer create-project hyperf/swow-skeleton #基于 Swow 驱动,则可在 Windows、Linux、Mac 下运行
mkdir /data/project1
cd /data/project1
composer create-project hyperf/hyperf-skeleton /data/hyperf_hello
php bin/hyperf.php start
3. 启动项目
cd /data/hyperf_hello
php bin/hyperf.php 命令会帮助提前创建所有需要生成的代理类和注解扫描缓存
php bin/hyperf.php start
热加载方案:
https://hyperf.wiki/2.2/#/zh-cn/watcher?id=%e7%83%ad%e6%9b%b4%e6%96%b0-watcher
composer require hyperf/watcher --dev
php bin/hyperf.php server:watch
4. 更新插件或者卸载
composer update -o
composer clearcache #清空缓存
跨库模型
Db::table('default')->update($data);
// test数据库链接表修改
Db::connection('test')->table('test')->update($data);
查看已安装的swoole的版本
php --ri swoole
查看phpinfo信息
php -r "phpinfo();" |grep swoole
错误:[Warning] World-writable config file '/etc/mysql/my.cnf' is ignored.
chmod 644 /etc/mysql/my.cnf
chmod 644 /etc/mysql/conf.d/*.cnf
chmod 644 /etc/mysql/conf.d/mysql.cnf