Package Data | |
---|---|
Maintainer Username: | danielamkaer |
Maintainer Contact: | daniel.amkaer@gmail.com (Daniel Amkær Sørensen) |
Package Create Date: | 2016-10-10 |
Package Last Update: | 2017-02-12 |
Home Page: | |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2024-11-19 03:15:03 |
Package Statistics | |
---|---|
Total Downloads: | 12,706 |
Monthly Downloads: | 2 |
Daily Downloads: | 0 |
Total Stars: | 1 |
Total Watchers: | 2 |
Total Forks: | 2 |
Total Open Issues: | 0 |
This is a simple Laravel Service Provider and Facade to access GuzzleHttp/Client, using configuration from a config file.
To install the PHP client library using Composer:
composer require amkr/laravel-guzzle-provider
Then add Amkr\Laravel\Guzzle\Providers\GuzzleServiceProvider
to the providers array in your config/app.php
.
Amkr\Laravel\Guzzle\Providers\GuzzleServiceProvider::class,
Add the Facade to the alias array in your app/config.php
:
'Guzzle' => Amkr\Laravel\Guzzle\Facades\Guzzle::class,
You can use artisan vendor:publish
to copy the distribution configuration file to your app's config directory:
php artisan vendor:publish
Adjust your configuration in config/guzzle.php
:
'default' => [
'base_uri' => 'http://localhost',
'verify' => '/path/to/ca-chain.pem',
],
You can access GuzzleHttp\Client through the Guzzle facade:
Guzzle::post('url', []);
Or you can specify to use a non-default configuration name by using the client()
method:
Guzzle::client('my-config')->post('url', []);