, (*1)
Swoole Extension for Yii 2
This extension provides an swoole for Yii framework 2.0 based on swoole., (*2)
For license information check the LICENSE-file., (*3)
, (*4)
Installation
The preferred way to install this extension is through composer., (*5)
Either run, (*6)
composer require parker714/yii2-s -vvv
Usage
After installation, you need to modify the configuration and then use it:, (*7)
# 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
1.More ways to use, (*8)
2.The idea of using swoole in yii2, (*9)
Add WeChat to learn more
, (*10)