An open API service indexing awesome lists of open source software.

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

Awesome Lists containing this project

README

          

# API Wrapper
An API wrapper for the @guzzle/guzzle package

[![Build Status](https://travis-ci.com/ellllllen/api-wrapper.svg?branch=master)](https://travis-ci.com/ellllllen/api-wrapper)
[![codecov](https://codecov.io/gh/ellllllen/api-wrapper/branch/master/graph/badge.svg)](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