Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/vuongxuongminh/yii2-gateway-clients
An abstraction layer provide the skeleton for buid rest api client (1-n) with Yii2 framework.
https://github.com/vuongxuongminh/yii2-gateway-clients
rest-api yii2 yii2-extension
Last synced: 4 months ago
JSON representation
An abstraction layer provide the skeleton for buid rest api client (1-n) with Yii2 framework.
- Host: GitHub
- URL: https://github.com/vuongxuongminh/yii2-gateway-clients
- Owner: vuongxuongminh
- License: bsd-3-clause
- Created: 2018-05-05T16:53:33.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2018-12-27T16:57:36.000Z (about 6 years ago)
- Last Synced: 2024-09-07T22:29:20.439Z (6 months ago)
- Topics: rest-api, yii2, yii2-extension
- Language: PHP
- Homepage:
- Size: 40 KB
- Stars: 4
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# YII2 Gateway Clients
**Skeleton for build rest api client (1-n).**[](https://packagist.org/packages/vxm/yii2-gateway-clients)
[](https://packagist.org/packages/vxm/yii2-gateway-clients)
[](https://travis-ci.org/vuongxuongminh/yii2-gateway-clients)
[](https://scrutinizer-ci.com/g/vuongxuongminh/yii2-gateway-clients/?branch=master)
[](https://scrutinizer-ci.com/g/vuongxuongminh/yii2-gateway-clients/?branch=master)
[](http://www.yiiframework.com/)This Yii2 extension is an abstraction layer provide the skeleton for build an api client (1-n).
## Requirements
* [PHP >= 7.1](http://php.net)
* [yiisoft/yii2 ~ 2.0.13](https://github.com/yiisoft/yii2)
* [yiisoft/yii2-httpclient ~ 2.0.0](https://github.com/yiisoft/yii2-httpclient)
* [vxm/gateway-clients ~ 1.0.0](https://github.com/vuongxuongminh/gateway-clients)## Installation
The preferred way to install this yii2-extension is through [composer](http://getcomposer.org/download/).
```sh
composer require "vxm/yii2-gateway-clients"
```or add
```json
"vxm/yii2-gateway-clients": "*"
```to the require section of your composer.json.
## Usage
This is an abstraction layer, you MUST be create your own classes implements it. It designed for DRY principle when you need to build rest api client.
## Abstract Classes Introduce
An abstract classes have been designed for implemented an interfaces. You should extends it for easier implements interfaces on your own classes.
|Abstract Class | Details|
|------|--------|
|[**BaseGateway**](src/BaseGateway.php)|Implemented [**GatewayInterface**](https://github.com/vuongxuongminh/gateway-clients/blob/master/src/GatewayInterface.php), abstract method your own class must create: `requestInternal`, `getBaseUrl`.
|[**BaseClient**](src/BaseClient.php)|Implemented [**ClientInterface**](https://github.com/vuongxuongminh/gateway-clients/blob/master/src/ClientInterface.php), it not have an abstract method your own class should add properties an information for access gateway server api.
|[**ResponseData**](src/ResponseData.php)|Abstract method your own class must create is `getIsOk` for end-user checking response data get from gateway server api is valid or not.## Need an example?
Click [**here**](examples/example.php) to read simple example.
## Project using it
* [yiiviet/yii2-esms](https://github.com/yiiviet/yii2-esms)
* [yiiviet/yii2-payment](https://github.com/yiiviet/yii2-payment)