https://github.com/ellen-merchant/api-wrapper
An API wrapper for the @guzzle/guzzle package
https://github.com/ellen-merchant/api-wrapper
api-wrapper guzzle guzzlehttp
Last synced: 6 months ago
JSON representation
An API wrapper for the @guzzle/guzzle package
- Host: GitHub
- URL: https://github.com/ellen-merchant/api-wrapper
- Owner: ellen-merchant
- Created: 2017-03-04T11:31:57.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2019-06-14T09:04:23.000Z (about 7 years ago)
- Last Synced: 2025-09-23T22:15:33.550Z (9 months ago)
- Topics: api-wrapper, guzzle, guzzlehttp
- Language: PHP
- Size: 28.3 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# API Wrapper
An API wrapper for the @guzzle/guzzle package
[](https://travis-ci.com/ellllllen/api-wrapper)
[](https://codecov.io/gh/ellllllen/api-wrapper)
## Installation
`composer require ellllllen/api-wrapper`
### Laravel 5 Implementation
1. In `app/config` add the package Service Provider to the providers array:
`\Ellllllen\ApiWrapper\ApiWrapperServiceProvider::class`
2. Perform `php artisan vendor:publish` command.
3. Add the configuration for the API you are querying in `config/api-wrapper`
## Usage
### GET request, with no parameters
```php
use Ellllllen\ApiWrapper\Connect;
class HomeController extends Controller
{
public function index(Connect $connect)
{
$response = $connect->doRequest();
dump($response);
}
}
```
### POST request, with parameters
```php
use Ellllllen\ApiWrapper\Connect;
class HomeController extends Controller
{
public function index(Connect $connect)
{
$response = $connect->doRequest('post', ['id' => 123, 'filter' => 'example']);
dump($response);
}
}
```
## Future Developments
1. Facility to connect to multiple APIs
2. API debugging facilities