Laravel5中安装Stone
安装依赖包, 如果你只运行Stone-Server, 则runkit可以不安装。
sudo pecl install swoole sudo pecl install runkit
composer安装Stone
composer require stone/kernel:dev-master
修改config/app.php, 加载Stone的Service Provider,
'providers' => [ // laravel定义的provider Illuminate\Auth\AuthServiceProvider::class, Illuminate\Broadcasting\BroadcastServiceProvider::class, .... .... // 中间省略的其他provider .... Qufenqi\Stone\StoneServiceProvider::class, // 应用层定义的provider App\Providers\AppServiceProvider::class, App\Providers\AuthServiceProvider::class, App\Providers\EventServiceProvider::class, App\Providers\RouteServiceProvider::class, ],
配置Stone: 新建 config/stone.php
return [ // server模式配置 'server' => [ 'handler' => 'App\Servers\Handler', // request handler 'user' => 'apple', // run user 'group' => 'apple', // run group 'domain' => '/var/run/stone-server-fpm.sock', 'pid' => '/run/stone-fpm.pid', 'process_name' => 'stone-server-fpm', 'worker_num' => 30, ], // web模式配置 'web' => [ 'user' => 'apple', // run user 'group' => 'apple', // run group 'domain' => '/var/run/stone-web-fpm.sock', // unix domain socket 'pid' => '/run/stone-web.pid', 'process_name' => 'stone-web-server', 'worker_num' => 30, // 需要建立快照的绑定 'snap_bindings' => [ 'view', 'db', 'cookie', 'session', 'session.store', //'config', // debugbar 需要重置config ], ], ];
- 安装完成