REST backend for Yii2 applications.
The preferred way to install this extension is through composer.
Either run
$ composer require oteixido/yii2-rest-backend "*"
or add
"oteixido/yii2-rest-backend": "*"
to the require section of your composer.json
file.
To use this extension, simply add the following code in your application configuration:
return [
//....
'components' => [
'httpClient' => [
'class' => '\oteixido\rest\http\HttpClient',
'baseUrl' => 'https://localhost.localdomain/api/v1',
'username' => 'username', // Default no username
'password' => 'password', // Default no password
'timeout' => 5, // Default 10 seconds
'sslVerify' => false, // Default true
],
],
];
Create docker image yii2-rest-backend for testing environment.
$ docker build . --tag yii2-rest-backend
$ docker run -it --rm -v "$PWD":/app -w /app yii2-rest-backend composer install
Execute tests.
$ docker run -it --rm -v "$PWD":/app -w /app yii2-rest-backend ./vendor/bin/codecept run --coverage