ml / fgc-client
HTTPlug-conformant file_get_contents HTTP client
1.0.1
2016-01-03 18:17 UTC
Requires
- php: >=5.4
- php-http/httplug: ^1.0.0-beta
- php-http/message-factory: ^1.0
Requires (Dev)
- guzzlehttp/psr7: ^1.0
- php-http/adapter-integration-tests: dev-master
- php-http/message: ^0.2
- phpunit/phpunit: ^4.8
Provides
This package is auto-updated.
Last update: 2024-12-25 21:35:52 UTC
README
This is a HTTPlug-conformant HTTP client based on file_get_contents
.
Installation
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": {
...
}
Usage
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:
require_once('vendor/autoload.php'); 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', 'http://example.com/'); $response = $client->sendRequest($request); echo $response->getStatusCode();