PHP code example of parker714 / yii2-s

1. Go to this page and download the library: Download parker714/yii2-s 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/ */

    

parker714 / yii2-s example snippets


# 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' => => \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