HTTPlug-conformant file_get_contents HTTP client

1.0.1 2016-01-03 18:17 UTC

This package is auto-updated.

Last update: 2024-02-25 20:04:33 UTC


Build Status Code Coverage

This is a HTTPlug-conformant HTTP client based on file_get_contents.


The easiest way to use fgc-client is to integrate it as a dependency in your project's composer.json file:

php composer.phar require ml/fgc-client ^1.0

Please note that HTTPlug hasn't released a stable version yet. Thus, for the time being, you need to set the minimum stability in your composer.json file to beta:

    "minimum-stability": "beta",
    "require": {


After having installed the desired dependencies

php composer.phar require guzzlehttp/psr7 ^1.0 php-http/message ^0.2

issuing an HTTP request is quite straightforward:


use Http\Message\MessageFactory\GuzzleMessageFactory;
use Http\Message\StreamFactory\GuzzleStreamFactory;
use ML\FgcClient\FgcHttpClient;

$messageFactory = new GuzzleMessageFactory();
$client = new FgcHttpClient($messageFactory, new GuzzleStreamFactory());

$request = $messageFactory->createRequest('GET', '');
$response = $client->sendRequest($request);

echo $response->getStatusCode();