Yii2-basic-RESTful-API-template
Simple web api, (*1)
Basic web api using POST or GET method with json response, (*2)
, (*3)
INSTALLATION
You can choose to install the application using one of the following methods., (*4)
Install via Composer
If you do not have Composer, you may install it by following the instructions
at getcomposer.org., (*5)
You can then install the application using the following command:, (*6)
php composer.phar global require "fxp/composer-asset-plugin:~1.1"
php composer.phar create-project --prefer-dist --stability=dev rockielin/yii2-basic-restful-api-template project-name
Enable debug:
create file "develop.me" in /config/, (*7)
Request:
all request using POST or GET method., (*8)
POST parameter validate using in controller:, (*9)
$this->checkParms(["parm1",
"parm2",.....]);
Response:
success reqponse format:, (*10)
{"data":json object,"status":200}
error reqponse format:, (*11)
{"data":"message","status":status code}
example of error output:, (*12)
throw new \yii\web\HttpException(401, "authentication failed!");