ellllllen / api-wrapper
There is no license information available for the latest version (1.0.0) of this package.
1.0.0
2018-03-18 16:36 UTC
Requires
- php: >=7.0
- guzzlehttp/guzzle: ^6.2
- illuminate/support: ^5.4
Requires (Dev)
- mockery/mockery: ^0.9.9
- phpunit/phpunit: 6.0
This package is not auto-updated.
Last update: 2024-05-21 15:07:58 UTC
README
An API wrapper for the @guzzle/guzzle package
Installation
composer require ellllllen/api-wrapper
Laravel 5 Implementation
-
In
app/config
add the package Service Provider to the providers array:\Ellllllen\ApiWrapper\ApiWrapperServiceProvider::class
-
Perform
php artisan vendor:publish
command. -
Add the configuration for the API you are querying in
config/api-wrapper
Usage
GET request, with no parameters
use Ellllllen\ApiWrapper\Connect; class HomeController extends Controller { public function index(Connect $connect) { $response = $connect->doRequest(); dump($response); } }
POST request, with parameters
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
- Facility to connect to multiple APIs
- API debugging facilities