parker714 / yii2-s
speed up yii2 app by swoole
Fund package maintenance!
github.com/parker714/yii2-s/blob/master/pb.jpeg
Installs: 164
Dependents: 0
Suggesters: 0
Security: 0
Stars: 34
Watchers: 6
Forks: 3
Open Issues: 0
Type:yii2-extension
Requires
- yiisoft/yii2: ~2.0.0
Replaces
- bower-asset/inputmask: >=3.2.0
- bower-asset/jquery: >=1.11.0
- bower-asset/punycode: >=1.3.0
- bower-asset/yii2-pjax: >=2.0.0
README
Swoole Extension for Yii 2
This extension provides an swoole for Yii framework 2.0 based on swoole.
For license information check the LICENSE-file.
Installation
The preferred way to install this extension is through composer.
Either run
composer require parker714/yii2-s -vvv
Usage
After installation, you need to modify the configuration and then use it:
# 1.Add the configuration in the console.php
...
'bootstrap' => ['log'],
'controllerMap' => [
'sw-http' => [
'class' => \parker714\yii2s\SwController::class,
'server' => [
'class' => \parker714\yii2s\servers\Http::class,
'webAppConf' => require(__DIR__ . '/web.php'),
],
...
# 2.Put the web.php configuration,sw exception、request、response are different from php-fpm
...
'components' => [
'errorHandler' => [
'class' => \parker714\yii2s\components\ErrorHandle::class,
'as errorResponse' => [
'class' => \parker714\yii2s\behaviors\ErrorResponse::class,
],
],
'response' => [
'class' => \parker714\yii2s\components\Response::class,
'format' => \yii\web\Response::FORMAT_JSON,
],
'request' => [
'class' => \parker714\yii2s\components\Request::class,
'parsers' => [
'application/json' => \yii\web\JsonParser::class,
],
]
...
# 3.Management server
./yii sw-http/server start|stop|reload
Tutorials
2.The idea of using swoole in yii2