Laravel5中安装Stone

  1. 安装依赖包, 如果你只运行Stone-Server, 则runkit可以不安装。

     sudo pecl install swoole
     sudo pecl install runkit
    
  2. composer安装Stone

     composer require stone/kernel:dev-master
    
  3. 修改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,
    
     ],
    
  4. 配置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
             ],
    
         ],
     ];
    
  5. 安装完成

results matching ""

    No results matching ""