nimaebrazi / php-http-client
Installs: 2
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 2
Forks: 0
Open Issues: 2
pkg:composer/nimaebrazi/php-http-client
Requires
- php: >=7.0
- guzzlehttp/guzzle: ^6.3
- psr/http-message: ^1.0
This package is not auto-updated.
Last update: 2023-12-12 03:17:55 UTC
README
Installation
composer
composer require nimaebrazi/php-http-client
Usage
ClientFactory methods return a instance of Client contract.
require_once "vendor/autoload.php"; $response = \NimaEbrazi\HttpClient\ClientFactory::guzzle()->get('YOUR_URL'); $response = \NimaEbrazi\HttpClient\ClientFactory::guzzle()->post('YOUR_URL'); $response = \NimaEbrazi\HttpClient\ClientFactory::guzzle()->put('YOUR_URL');
Client Option
If client has special config, you can pass it to factory methods:
$response = \NimaEbrazi\HttpClient\ClientFactory::guzzle([ 'config_key' => 'config_value '])->get('YOUR_URL');
Request Options
You can also pass request option
$response = \NimaEbrazi\HttpClient\ClientFactory::guzzle()->get('YOUR_URL', ['OPTION_KEY' => 'OPTION_VALUE']);