Skip to content

shabazy/guzzle-http-client

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Guzzle HTTP Client

Install for all dependencies;

composer install

Run for tests;

./vendor/bin/phpunit src/tests --colors

Usage:

Initialize:

# HttpClient((string) username, (string) password', (array) options);

Example:

$options = ['timeout' => 120, 'headers' => [sprintf('Token %s', '...blablabla...']]
$client = new HttpClient('username', 'password', $options);

GET Request:

$response = $client->makeRequest('get', 'https:www/google.com/?q=guzzle');

POST Request:

$params = [
            'key' => 'value',
            'key2' => 'value2',
          ]
$response = $client->makeRequest('post', 'https:www/google.com/', $params);

Get Content:


$content = $response->getBody()->getContent();

Releases

No releases published

Packages

No packages published

Languages