nimaebrazi/php-http-client

This package is abandoned and no longer maintained. No replacement package was suggested.

1.0.0 2019-10-20 08:34 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']);