oteixido/yii2-rest-backend

Components to use a REST backend in Yii2 applications

Installs: 2

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 2

Forks: 0

Open Issues: 0

Type:yii2-extension

0.1 2018-03-31 20:14 UTC

This package is not auto-updated.

Last update: 2024-04-28 03:19:56 UTC


README

REST backend for Yii2 applications.

Installation

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.

Configuration

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
        ],
    ],
];

Testing

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

License

GNU General Public License v3.0