An API wrapper for the @guzzle/guzzle package
composer require ellllllen/api-wrapper
-
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
use Ellllllen\ApiWrapper\Connect;
class HomeController extends Controller
{
public function index(Connect $connect)
{
$response = $connect->doRequest();
dump($response);
}
}
use Ellllllen\ApiWrapper\Connect;
class HomeController extends Controller
{
public function index(Connect $connect)
{
$response = $connect->doRequest('post', ['id' => 123, 'filter' => 'example']);
dump($response);
}
}
- Facility to connect to multiple APIs
- API debugging facilities