2017 © Pedro Peláez
 

yii2-extension yii2-swoole

yii2-swoole

image

ctaolee/yii2-swoole

yii2-swoole

  • Thursday, May 10, 2018
  • by cTaoLee
  • Repository
  • 1 Watchers
  • 0 Stars
  • 5 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 25 % Grown

The README.md

使用:

使用 composer 安装 composer require ctaolee/yii2-swoole 创建类似以下php脚本:, (*1)

<?php
defined('YII_DEBUG') or define('YII_DEBUG', true);
defined('YII_ENV') or define('YII_ENV', 'dev');

require __DIR__ . '/vendor/autoload.php';
require __DIR__ . '/vendor/yiisoft/yii2/Yii.php';

$config = require __DIR__ . '/config/web.php';

$swooleConfig = [
    // ... 这里配置swoole
];
$server = new ctaolee\swoole\SwooleServer();
$server->run($config, '0.0.0.0', 9501, $swooleConfig);

热重载

需要安装 inotify 扩展,可以通过 pecl 来安装,同时需要添加类似以下配置, (*2)

$swooleConfig = [
    // ... 其他配置

    'hot_reload' => true,                               // 开启热重载
    'inotify_files' => [
        __DIR__ . '/models',
        __DIR__ . '/modules',
        __DIR__ . '/config',
    ],
    'pid_file' => __DIR__ . '/runtime/swoole.pid',      // pid文件位置,必须配置


];

Session

只实现了 redis-session, (*3)

[
    // ... 其他配置
    'components' => [
        // ... 其他配置
         'session' => [
            'class' => 'ctaolee\swoole\session\RedisSession',
            'redis' => 'redis',
            'timeout' => 3600,
        ],
    ]
];

The Versions

10/05 2018

dev-master

9999999-dev https://github.com/ctaolee/yii2-swoole

yii2-swoole

  Sources   Download

MIT

The Requires

  • php >=7.0.0

 

by Avatar cTaoLee

yii2 swoole