PHP code example of dionyang25 / yii2-swoole-plugin
1. Go to this page and download the library: Download dionyang25/yii2-swoole-plugin library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
defined('YII_DEBUG') or define('YII_DEBUG',true);
defined('YII_ENV') or define('YII_ENV', 'dev');
$config = \yii\helpers\ArrayHelper::merge(
namespace app\commands;
use yii\console\Controller;
use Yii;
/**
* @author DionYang
* @since 2.0
*/
class HelloController extends Controller
{
/**
* This command echoes what you have entered as the message.
* @param string $message the message to be echoed.
*/
public function actionIndex()
{
$server =Yii::$app->yii2Swoole;
$server->entrance_file = __DIR__.'/../php-backstreet-api/index-test.php';
$server->run();
}
public function actionStop()
{
$this->stdout('Already Stop'.PHP_EOL);
Yii::$app->yii2Swoole->appStop();
}
}