2017 © Pedro Peláez
 

library grasshopper

Thin wrapper class library of cURL

image

stk2k/grasshopper

Thin wrapper class library of cURL

  • Wednesday, January 24, 2018
  • by stk2k
  • Repository
  • 1 Watchers
  • 0 Stars
  • 98 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 54 Versions
  • 0 % Grown

The README.md

Grasshopper, PHP HTTP Multi Request Client

Description

Grasshopper is a yet another cURL PHP library wchich makes you easy to send HTTP request. This library can process multiple requests at once., (*1)

Feature

  • supports process multiple requests in one call
  • easy to use: simple interface
  • variety of error handling: both supported procedural or callback

Demo

use Grasshopper\Grasshopper;
use \Grasshopper\event\SuccessEvent;
use \Grasshopper\event\ErrorEvent;

$hopper = new Grasshopper();

$url = 'http://example.com';

$hopper->addRequest($url);

$result = $hopper->waitForAll();

$res = $result[$url];
if ( $res instanceof SuccessEvent ){
    // success
    $status = $res->getResponse()->getStatusCode();
    $body = $res->getResponse()->getBody();
    echo "success: status=$status" . PHP_EOL;
    echo $body . PHP_EOL;
}
elseif ( $res instanceof ErrorEvent ){
    // error
    echo "error: " . $res->getError()->getMessage() . PHP_EOL;
}

Usage

  1. create grashopper object.
  2. add HttpGet/HttpPostRequest to grasshopper object.
  3. execute Grasshopper#waitforAll() method.
  4. get response from returned array.the key is requested URL.
  5. check response object whether SuccessEvent or ErrorEvent.SuccessEvent means request was succeeded, ErrorEvent means failure.
  6. you can get response object from SuccessEvent. it provides status code and response body.
  7. you can get error information from ErrorEvent. it provides error code and message.

Requirement

PHP 5.5 or later, (*2)

Installing Grasshopper

The recommended way to install Grasshopper is through Composer., (*3)

composer require stk2k/grasshopper

After installing, you need to require Composer's autoloader:, (*4)

require 'vendor/autoload.php';

License

MIT, (*5)

Author

stk2k, (*6)

Disclaimer

This software is no warranty., (*7)

We are not responsible for any results caused by the use of this software., (*8)

Please use the responsibility of the your self., (*9)

The Versions

24/01 2018

dev-master

9999999-dev https://github.com/stk2k/grasshopper

Thin wrapper class library of cURL

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

by Katsuki Shuto

curl

24/01 2018

0.8.1

0.8.1.0 https://github.com/stk2k/grasshopper

Thin wrapper class library of cURL

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

by Katsuki Shuto

curl

24/01 2018

0.8.0

0.8.0.0 https://github.com/stk2k/grasshopper

Thin wrapper class library of cURL

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

by Katsuki Shuto

curl

01/10 2017

0.7.11

0.7.11.0 https://github.com/stk2k/grasshopper

Thin wrapper class library of cURL

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

by Katsuki Shuto

curl

22/09 2017

0.7.10

0.7.10.0 https://github.com/stk2k/grasshopper

Thin wrapper class library of cURL

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

by Katsuki Shuto

curl

21/09 2017

0.7.9

0.7.9.0 https://github.com/stk2k/grasshopper

Thin wrapper class library of cURL

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

by Katsuki Shuto

curl

19/09 2017

0.7.8

0.7.8.0 https://github.com/stk2k/grasshopper

Thin wrapper class library of cURL

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

by Katsuki Shuto

curl

14/09 2017

0.7.7

0.7.7.0 https://github.com/stk2k/grasshopper

Thin wrapper class library of cURL

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

by Katsuki Shuto

curl

17/07 2017

0.7.6

0.7.6.0 https://github.com/stk2k/grasshopper

Thin wrapper class library of cURL

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

by Katsuki Shuto

curl

17/07 2017

0.7.5

0.7.5.0 https://github.com/stk2k/grasshopper

Thin wrapper class library of cURL

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

by Katsuki Shuto

curl

16/07 2017

0.7.4

0.7.4.0 https://github.com/stk2k/grasshopper

Thin wrapper class library of cURL

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

by Katsuki Shuto

curl

16/07 2017

0.7.3

0.7.3.0 https://github.com/stk2k/grasshopper

Thin wrapper class library of cURL

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

by Katsuki Shuto

curl

16/07 2017

0.7.2

0.7.2.0 https://github.com/stk2k/grasshopper

Thin wrapper class library of cURL

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

by Katsuki Shuto

curl

16/07 2017

0.7.1

0.7.1.0 https://github.com/stk2k/grasshopper

Thin wrapper class library of cURL

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

by Katsuki Shuto

curl

16/07 2017

0.7.0

0.7.0.0 https://github.com/stk2k/grasshopper

Thin wrapper class library of cURL

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

by Katsuki Shuto

curl

13/07 2017

0.6.7

0.6.7.0 https://github.com/stk2k/grasshopper

Thin wrapper class library of cURL

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

by Katsuki Shuto

curl

13/07 2017

0.6.6

0.6.6.0 https://github.com/stk2k/grasshopper

Thin wrapper class library of cURL

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

by Katsuki Shuto

curl

13/07 2017

0.6.5

0.6.5.0 https://github.com/stk2k/grasshopper

Thin wrapper class library of cURL

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

by Katsuki Shuto

curl

13/07 2017

0.6.4

0.6.4.0 https://github.com/stk2k/grasshopper

Thin wrapper class library of cURL

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

by Katsuki Shuto

curl

12/07 2017

0.6.3

0.6.3.0 https://github.com/stk2k/grasshopper

Thin wrapper class library of cURL

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

by Katsuki Shuto

curl

12/07 2017

0.6.2

0.6.2.0 https://github.com/stk2k/grasshopper

Thin wrapper class library of cURL

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

by Katsuki Shuto

curl

12/07 2017

0.6.1

0.6.1.0 https://github.com/stk2k/grasshopper

Thin wrapper class library of cURL

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

by Katsuki Shuto

curl

06/06 2017

0.6.0

0.6.0.0 https://github.com/stk2k/grasshopper

Thin wrapper class library of cURL

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

by Katsuki Shuto

curl

01/10 2016

0.5.8

0.5.8.0 https://github.com/stk2k/grasshopper

Thin wrapper class library of cURL

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

by Katsuki Shuto

curl

27/09 2016

0.5.7

0.5.7.0 https://github.com/stk2k/grasshopper

Thin wrapper class library of cURL

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

by Katsuki Shuto

curl

22/09 2016

0.5.6

0.5.6.0 https://github.com/stk2k/grasshopper

Thin wrapper class library of cURL

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

by Katsuki Shuto

curl

18/09 2016

0.5.5

0.5.5.0 https://github.com/stk2k/grasshopper

Thin wrapper class library of cURL

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

by Katsuki Shuto

curl

18/09 2016

0.5.4

0.5.4.0 https://github.com/stk2k/grasshopper

Thin wrapper class library of cURL

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

by Katsuki Shuto

curl

16/09 2016

0.5.3

0.5.3.0 https://github.com/stk2k/grasshopper

Thin wrapper class library of cURL

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

by Katsuki Shuto

curl

16/09 2016

0.5.2

0.5.2.0 https://github.com/stk2k/grasshopper

Thin wrapper class library of cURL

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

by Katsuki Shuto

curl

10/09 2016

0.5.1

0.5.1.0 https://github.com/stk2k/grasshopper

Thin wrapper class library of cURL

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

by Katsuki Shuto

curl

10/09 2016

0.5.0

0.5.0.0 https://github.com/stk2k/grasshopper

Thin wrapper class library of cURL

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

by Katsuki Shuto

curl

10/09 2016

0.4.1

0.4.1.0 https://github.com/stk2k/grasshopper

Thin wrapper class library of cURL

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

by Katsuki Shuto

curl

10/09 2016

0.4.0

0.4.0.0 https://github.com/stk2k/grasshopper

Thin wrapper class library of cURL

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

by Katsuki Shuto

curl

10/07 2016

0.3.12

0.3.12.0 https://github.com/stk2k/grasshopper

Thin wrapper class library of cURL

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

by Katsuki Shuto

curl

10/07 2016

0.3.11

0.3.11.0 https://github.com/stk2k/grasshopper

Thin wrapper class library of cURL

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

by Katsuki Shuto

curl

12/06 2016

0.3.10

0.3.10.0 https://github.com/stk2k/grasshopper

Thin wrapper class library of cURL

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

by Katsuki Shuto

curl

05/03 2016

0.3.9

0.3.9.0 https://github.com/stk2k/grasshopper

Thin wrapper class library of cURL

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

by Katsuki Shuto

curl

04/03 2016

0.3.8

0.3.8.0 https://github.com/stk2k/grasshopper

Thin wrapper class library of cURL

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

by Katsuki Shuto

curl

11/01 2016

0.3.7

0.3.7.0 https://github.com/stk2k/grasshopper

Thin wrapper class library of cURL

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

by Katsuki Shuto

curl

09/01 2016

0.3.6

0.3.6.0 https://github.com/stk2k/grasshopper

Thin wrapper class library of cURL

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

by Katsuki Shuto

curl

08/01 2016

0.3.5

0.3.5.0 https://github.com/stk2k/grasshopper

Thin wrapper class library of cURL

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

by Katsuki Shuto

curl

08/01 2016

0.3.4

0.3.4.0 https://github.com/stk2k/grasshopper

Thin wrapper class library of cURL

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

by Katsuki Shuto

curl

08/01 2016

0.3.3

0.3.3.0 https://github.com/stk2k/grasshopper

Thin wrapper class library of cURL

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

by Katsuki Shuto

curl

08/01 2016

0.3.2

0.3.2.0 https://github.com/stk2k/grasshopper

Thin wrapper class library of cURL

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

by Katsuki Shuto

curl

08/01 2016

0.3.1

0.3.1.0 https://github.com/stk2k/grasshopper

Thin wrapper class library of cURL

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

by Katsuki Shuto

curl

08/01 2016

0.3.0

0.3.0.0 https://github.com/stk2k/grasshopper

Thin wrapper class library of cURL

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

by Katsuki Shuto

curl

08/01 2016

0.2.9

0.2.9.0 https://github.com/stk2k/grasshopper

Thin wrapper class library of cURL

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

by Katsuki Shuto

curl

08/01 2016

0.2.8

0.2.8.0 https://github.com/stk2k/grasshopper

Thin wrapper class library of cURL

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

by Katsuki Shuto

curl

07/01 2016

0.2.7

0.2.7.0 https://github.com/stk2k/grasshopper

Thin wrapper class library of cURL

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

by Katsuki Shuto

curl

07/01 2016

0.2.6

0.2.6.0 https://github.com/stk2k/grasshopper

Thin wrapper class library of cURL

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

by Katsuki Shuto

curl

07/01 2016

0.2.5

0.2.5.0 https://github.com/stk2k/grasshopper

Thin wrapper class library of cURL

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

by Katsuki Shuto

curl

07/01 2016

0.2.4

0.2.4.0 https://github.com/stk2k/grasshopper

Thin wrapper class library of cURL

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

by Katsuki Shuto

curl

04/01 2016

0.1.0

0.1.0.0 https://github.com/stk2k/grasshopper

Thin wrapper class library of cURL

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

by Katsuki Shuto

curl