2017 © Pedro Peláez
 

library simple-http-bundle

A very simple symfony2 http client bundle built on the httpfoundation component (instead of guzzle), using cURL and cURL multi.

image

evaisse/simple-http-bundle

A very simple symfony2 http client bundle built on the httpfoundation component (instead of guzzle), using cURL and cURL multi.

  • Tuesday, June 20, 2017
  • by evaisse
  • Repository
  • 4 Watchers
  • 4 Stars
  • 23,162 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 36 Versions
  • 13 % Grown

The README.md

SimpleHttpBundle

While Still maintained, I recommand you to replace this bundle with the symfony/http-client with has better support and a handy plug-in support.

A symfony2/3/4/5 http client bundle built on the httpfoundation component (instead of guzzle), using cURL as engine., (*1)

Coverage Status, (*2)

Quickstart

Get the simple API, (*3)

$http = $this->container->get('http');
$http = $this->get('http');

// same as  

try {
    $http->GET('http://httpbin.org/ip'); // yeah, that's all.
} catch (\Symfony\Component\HttpKernel\Exception\HttpException $e) {
    // handle errors
}

try {
    $data = $http->POST('http://httpbin.org/post', $myArgs);
} catch (\Symfony\Component\HttpKernel\Exception\HttpException $e) {
    // handle errors
}

Easy routing with replacement syntax (similar to php frameworks like symfony2/laravel), (*4)

$data = $http->GET('http://httpbin.org/status/{code}', array(
    "code" => 200
));
// will call http://httpbin.org/status/200

$data = $http->GET('http://httpbin.org/status/{code}', array(
    "code" => 200,
    "foo" => "bar" 
));
// will call http://httpbin.org/status/200?foo=bar

Development features

The simple http bundle provide you a nice profiler toolbar addition, (*5)

  • Request/Response body & headers details
  • Cookies handy panel
  • External debug links (to remote profiler using X-Debug-Link header)
  • Request timing displayed in the timeline panel

Replay feature

Add this to routing.yml file, (*6)

_simple_http:
    resource: "@SimpleHttpBundle/Controller/"
    type:     annotation
    prefix:   /_profiler/simple-http

or, (*7)

_simple_http:
    resource: '@SimpleHttpBundle/Resources/config/routing.yml'

You can now resend an http call directly from the profiler debug panel, (*8)

Panels details

Panels details, (*9)

Toolbar block

Toolbar block, (*10)

Timeline panel

Timeline panel, (*11)

Complete API

Complete api using transaction factory, (*12)

$transac = $http->prepare('GET', 'http://httpbin.org/ip');

$transac->execute();

Parrallel execution, (*13)

$a = $http->prepare('GET', 'http://httpbin.org/ip');
$b = $http->prepare('PUT', 'http://httpbin.org/put');
$c = $http->prepare('POST', 'http://httpbin.org/post');

$http->execute([
    $a, 
    $b,
    $c
]);

$a->hasError() || $a->getResult();
$b->hasError() || $b->getResult();
$c->hasError() || $c->getResult();

JSON services, (*14)

print $http->prepare('POST', 'http://httpbin.org/ip', $_SERVER)
           ->json()
           ->execute()
           ->getResult()['ip'];

File upload, (*15)

$http->prepare('PUT', 'http://httpbin.org/put')
     ->addFile('f1', './myfile.txt')
     ->addFile('f2', './myfile.txt')
     ->execute();


$http->prepare('POST', 'http://httpbin.org/post', [
        'infos' => 'foo',
        'bar'   => 'so so',
    ])
     ->addFile('f1', './myfile.txt')
     ->addFile('f2', './myfile.txt')
     ->execute();

Cookies persistance, (*16)

$a = $http->prepare('GET',  'http://httpbin.org/ip');
$b = $http->prepare('PUT',  'http://httpbin.org/put');
$c = $http->prepare('POST', 'http://httpbin.org/post');


$cookies = $http->getDefaultCookieJar();
 // $cookies = $http->getCookieJar($session); if you want to directly store in user session

$http->execute([
    $a, 
    $b,
    $c
], $cookies);

dump($cookies);

Promise usage, (*17)

$stmt = $http->prepare('PUT', 'http://httpbin.org/put')

$stmt->onSuccess(function ($data) {
    // handle data
})->onError(function (\Symfony\Component\HttpKernel\Exception\HttpException $e) {
    // handle errors
})->onFinish(function () {
    // like "finally"
});

$http->execute([
    $stmt
]);

The Versions

20/06 2017

dev-master

9999999-dev https://github.com/evaisse/SimpleHttpBundle

A very simple symfony2 http client bundle built on the httpfoundation component (instead of guzzle), using cURL and cURL multi.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Emmanuel VAÏSSE

curl http symfony client simple requests httpfoundation curlmulti

20/06 2017

v2.1.1

2.1.1.0 https://github.com/evaisse/SimpleHttpBundle

A very simple symfony2 http client bundle built on the httpfoundation component (instead of guzzle), using cURL and cURL multi.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Emmanuel VAÏSSE

curl http symfony client simple requests httpfoundation curlmulti

20/06 2017

v2.1.0

2.1.0.0 https://github.com/evaisse/SimpleHttpBundle

A very simple symfony2 http client bundle built on the httpfoundation component (instead of guzzle), using cURL and cURL multi.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Emmanuel VAÏSSE

curl http symfony client simple requests httpfoundation curlmulti

02/02 2017

dev-feature/symfony3

dev-feature/symfony3 https://github.com/evaisse/SimpleHttpBundle

A very simple symfony2 http client bundle built on the httpfoundation component (instead of guzzle), using cURL and cURL multi.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Emmanuel VAÏSSE

curl http symfony client simple requests httpfoundation curlmulti

02/02 2017

v0.3.8

0.3.8.0 https://github.com/evaisse/SimpleHttpBundle

A very simple symfony2 http client bundle built on the httpfoundation component (instead of guzzle), using cURL and cURL multi.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Emmanuel VAÏSSE

curl http symfony client simple requests httpfoundation curlmulti

02/02 2017

v1.0.4

1.0.4.0 https://github.com/evaisse/SimpleHttpBundle

A very simple symfony2 http client bundle built on the httpfoundation component (instead of guzzle), using cURL and cURL multi.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Emmanuel VAÏSSE

curl http symfony client simple requests httpfoundation curlmulti

02/02 2017

v2.0.1

2.0.1.0 https://github.com/evaisse/SimpleHttpBundle

A very simple symfony2 http client bundle built on the httpfoundation component (instead of guzzle), using cURL and cURL multi.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Emmanuel VAÏSSE

curl http symfony client simple requests httpfoundation curlmulti

02/02 2017

v0.3.7

0.3.7.0 https://github.com/evaisse/SimpleHttpBundle

A very simple symfony2 http client bundle built on the httpfoundation component (instead of guzzle), using cURL and cURL multi.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Emmanuel VAÏSSE

curl http symfony client simple requests httpfoundation curlmulti

29/11 2016

v0.4.1

0.4.1.0 https://github.com/evaisse/SimpleHttpBundle

A very simple symfony2 http client bundle built on the httpfoundation component (instead of guzzle), using cURL and cURL multi.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Emmanuel VAÏSSE

curl http symfony client simple requests httpfoundation curlmulti

29/11 2016

dev-feature/symfony2

dev-feature/symfony2 https://github.com/evaisse/SimpleHttpBundle

A very simple symfony2 http client bundle built on the httpfoundation component (instead of guzzle), using cURL and cURL multi.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Emmanuel VAÏSSE

curl http symfony client simple requests httpfoundation curlmulti

29/11 2016

v0.3.6

0.3.6.0 https://github.com/evaisse/SimpleHttpBundle

A very simple symfony2 http client bundle built on the httpfoundation component (instead of guzzle), using cURL and cURL multi.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Emmanuel VAÏSSE

curl http symfony client simple requests httpfoundation curlmulti

07/10 2016

v0.3.5

0.3.5.0 https://github.com/evaisse/SimpleHttpBundle

A very simple symfony2 http client bundle built on the httpfoundation component (instead of guzzle), using cURL and cURL multi.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Emmanuel VAÏSSE

curl http symfony client simple requests httpfoundation curlmulti

26/09 2016

v0.3.4

0.3.4.0 https://github.com/evaisse/SimpleHttpBundle

A very simple symfony2 http client bundle built on the httpfoundation component (instead of guzzle), using cURL and cURL multi.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Emmanuel VAÏSSE

curl http symfony client simple requests httpfoundation curlmulti

09/09 2016

v1.0.2

1.0.2.0 https://github.com/evaisse/SimpleHttpBundle

A very simple symfony2 http client bundle built on the httpfoundation component (instead of guzzle), using cURL and cURL multi.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Emmanuel VAÏSSE

curl http symfony client simple requests httpfoundation curlmulti

09/09 2016

v1.0.1

1.0.1.0 https://github.com/evaisse/SimpleHttpBundle

A very simple symfony2 http client bundle built on the httpfoundation component (instead of guzzle), using cURL and cURL multi.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Emmanuel VAÏSSE

curl http symfony client simple requests httpfoundation curlmulti

11/03 2016

v0.3.2

0.3.2.0 https://github.com/evaisse/SimpleHttpBundle

A very simple symfony2 http client bundle built on the httpfoundation component (instead of guzzle), using cURL and cURL multi.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Emmanuel VAÏSSE

curl http symfony client simple requests httpfoundation curlmulti

23/02 2016

v0.3.1

0.3.1.0 https://github.com/evaisse/SimpleHttpBundle

A very simple symfony2 http client bundle built on the httpfoundation component (instead of guzzle), using cURL and cURL multi.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Emmanuel VAÏSSE

curl http symfony client simple requests httpfoundation curlmulti

23/02 2016

dev-feature/replay-api-request

dev-feature/replay-api-request https://github.com/evaisse/SimpleHttpBundle

A very simple symfony2 http client bundle built on the httpfoundation component (instead of guzzle), using cURL and cURL multi.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Emmanuel VAÏSSE

curl http symfony client simple requests httpfoundation curlmulti

19/02 2016

v0.3.0

0.3.0.0 https://github.com/evaisse/SimpleHttpBundle

A very simple symfony2 http client bundle built on the httpfoundation component (instead of guzzle), using cURL and cURL multi.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Emmanuel VAÏSSE

curl http symfony client simple requests httpfoundation curlmulti

05/10 2015

v0.2.6

0.2.6.0 https://github.com/evaisse/SimpleHttpBundle

A very simple symfony2 http client bundle built on the httpfoundation component (instead of guzzle), using cURL and cURL multi.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Emmanuel VAÏSSE

curl http symfony client simple requests httpfoundation curlmulti

05/10 2015

v0.2.7

0.2.7.0 https://github.com/evaisse/SimpleHttpBundle

A very simple symfony2 http client bundle built on the httpfoundation component (instead of guzzle), using cURL and cURL multi.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Emmanuel VAÏSSE

curl http symfony client simple requests httpfoundation curlmulti

18/09 2015

v0.2.5

0.2.5.0 https://github.com/evaisse/SimpleHttpBundle

A very simple symfony2 http client bundle built on the httpfoundation component (instead of guzzle), using cURL and cURL multi.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Emmanuel VAÏSSE

curl http symfony client simple requests httpfoundation curlmulti

17/09 2015

v0.2.4

0.2.4.0 https://github.com/evaisse/SimpleHttpBundle

A very simple symfony2 http client bundle built on the httpfoundation component (instead of guzzle), using cURL and cURL multi.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Emmanuel VAÏSSE

curl http symfony client simple requests httpfoundation curlmulti

30/07 2015

v0.2.3

0.2.3.0 https://github.com/evaisse/SimpleHttpBundle

A very simple symfony2 http client bundle built on the httpfoundation component (instead of guzzle), using cURL and cURL multi.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Emmanuel VAÏSSE

curl http symfony client simple requests httpfoundation curlmulti

21/07 2015

v0.2.2

0.2.2.0 https://github.com/evaisse/SimpleHttpBundle

A very simple symfony2 http client bundle built on the httpfoundation component (instead of guzzle), using cURL and cURL multi.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Emmanuel VAÏSSE

curl http symfony client simple requests httpfoundation curlmulti

21/07 2015

v0.2.1

0.2.1.0 https://github.com/evaisse/SimpleHttpBundle

A very simple symfony2 http client bundle built on the httpfoundation component (instead of guzzle), using cURL and cURL multi.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Emmanuel VAÏSSE

curl http symfony client simple requests httpfoundation curlmulti

20/07 2015

v0.1.8

0.1.8.0 https://github.com/evaisse/SimpleHttpBundle

A very simple symfony2 http client bundle built on the httpfoundation component (instead of guzzle), using cURL and cURL multi.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Emmanuel VAÏSSE

curl http symfony client simple requests httpfoundation curlmulti

13/07 2015

v0.1.6

0.1.6.0 https://github.com/evaisse/SimpleHttpBundle

A very simple symfony2 http client bundle built on the httpfoundation component (instead of guzzle), using cURL and cURL multi.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Emmanuel VAÏSSE

curl http symfony client simple requests httpfoundation curlmulti

13/07 2015

v0.1.7

0.1.7.0 https://github.com/evaisse/SimpleHttpBundle

A very simple symfony2 http client bundle built on the httpfoundation component (instead of guzzle), using cURL and cURL multi.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Emmanuel VAÏSSE

curl http symfony client simple requests httpfoundation curlmulti

10/07 2015

v0.1.5

0.1.5.0 https://github.com/evaisse/SimpleHttpBundle

A very simple symfony2 http client bundle built on the httpfoundation component (instead of guzzle), using cURL and cURL multi.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Emmanuel VAÏSSE

curl http symfony client simple requests httpfoundation curlmulti

29/06 2015

v0.1.4

0.1.4.0 https://github.com/evaisse/SimpleHttpBundle

A very simple symfony2 http client bundle built on the httpfoundation component (instead of guzzle), using cURL and cURL multi.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Emmanuel VAÏSSE

curl http symfony client simple requests httpfoundation curlmulti

29/06 2015

v0.1.3

0.1.3.0 https://github.com/evaisse/SimpleHttpBundle

A very simple symfony2 http client bundle built on the httpfoundation component (instead of guzzle), using cURL and cURL multi.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Emmanuel VAÏSSE

curl http symfony client simple requests httpfoundation curlmulti

29/06 2015

v0.0.2

0.0.2.0 https://github.com/evaisse/SimpleHttpBundle

A very simple symfony2 http client bundle built on the httpfoundation component (instead of guzzle), using cURL and cURL multi.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Emmanuel VAÏSSE

curl http symfony client simple requests httpfoundation curlmulti

29/06 2015

v0.1.2

0.1.2.0 https://github.com/evaisse/SimpleHttpBundle

A very simple symfony2 http client bundle built on the httpfoundation component (instead of guzzle), using cURL and cURL multi.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Emmanuel VAÏSSE

curl http symfony client simple requests httpfoundation curlmulti

24/06 2015

v0.1.1

0.1.1.0 https://github.com/evaisse/SimpleHttpBundle

A very simple symfony2 http client bundle built on the httpfoundation component (instead of guzzle), using cURL and cURL multi.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Emmanuel VAÏSSE

curl http symfony client simple requests httpfoundation curlmulti

16/06 2015

v0.1.0

0.1.0.0 https://github.com/evaisse/SimpleHttpBundle

A very simple symfony2 http client bundle built on the httpfoundation component (instead of guzzle), using cURL and cURL multi.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Emmanuel VAÏSSE

curl http symfony client simple requests httpfoundation curlmulti