Download the PHP package media24si/api-resource without Composer
On this page you can find all versions of the php package media24si/api-resource. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download media24si/api-resource
More information about media24si/api-resource
Files in media24si/api-resource
Package api-resource
Short Description Laravel Guzzle Api Resource Package
License MIT
Homepage https://github.com/Media24si/ApiResource
Informations about the package api-resource
Api Resource
A simple Guzzle wrapper, providing easy access to API endpoints.
For Guzzle v5.0 support use v1.0.0
Install - Laravel
Require this package with Composer (Packagist), using the following command:
Register the ApiResourceServiceProvider to the providers array in config/app.php
:
Publish vendor files (config file):
Optional
Register the facade in config/app.php
:
Install - Lumen
Require this package with Composer (Packagist), using the following command:
Register the ApiResourceServiceProvider inside bootstrap/app.php
(Lumen):
Copy the config file from the vendor vendor/media24si/api-resource/src/config/apiresrouce.php
to your local config folder config/apiresource.php
and enable the config inside your bootstrap/app.php
(Lumen):
Optional
Register the facade in bootstrap/app.php
(Lumen):
also, make sure you uncomment this line from the same file:
Usage
You can use this package without any configuration. Just use the \Api facade in your controller (or inject Media24si\ApiResource\ApiResource in your function/controller).
Call your endpoints, like you would a normal Guzzle request:
Config
defaults
Associative array of Request Options, that are applied to every request, created by the client. See the official manual .
Example: php 'endpoints' => [ 'notification' => [ 'uri' => 'http://httpbin.org/notification' ], 'categories' => [ 'uri' => '/categories', // with base_uri set 'options' => [ 'query' => [ 'fields' => 'id, title' ] ] ] ] php \Api::get('notification') php \Api::get('categories', ['query' => ['fields' => 'id, title, slug']])
## License
The MIT License (MIT). Please see [License File](LICENSE.md) for more information.
[manual]: http://guzzle.readthedocs.org/en/latest/