Skip to content

HTTP Client which grants finite timeouts for requests to avoid indefinite waits (Guzzle does).

License

Notifications You must be signed in to change notification settings

stayforlong/finite-guzzlehttp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Finite Guzzle HTTP

HTTP Client which grants finite timeouts for requests to avoid indefinite waits (Guzzle does).

Installation

Install the latest version through Composer:

$ composer require stayforlong/finite-guzzlehttp:0.1.0

Usage

Use dependency injection to autoload Guzzle, which is used under the hood:

<?php

use StayForLong\FiniteGuzzleHTTP\Client;

class MyClient {
    private $finiteClient;

    public function __construct(Client $client) {
        $this->finiteClient = $client;
    }

    public function finiteGet($unstableEndpoint) {
        $this->finiteClient->get($unstableEndpoint);
    }
}

// ...

try {
    $myClient->finiteGet(UNSTABLE_ENDPOINT);
} catch (ConnectException $e) {
    // do not let your requests wait forever
}

About

HTTP Client which grants finite timeouts for requests to avoid indefinite waits (Guzzle does).

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages