2017 © Pedro Peláez
 

library curl

cURL object wrapper.

image

phpgt/curl

cURL object wrapper.

  • Monday, July 30, 2018
  • by g105b
  • Repository
  • 1 Watchers
  • 0 Stars
  • 4 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 2 Open issues
  • 12 Versions
  • 0 % Grown

The README.md

cURL object wrapper.

This library wraps PHP's native cURL extension functions with objects, for better code readability and testability., (*1)

Why? We wanted to lay an object oriented foundation for PHP.Gt/Fetch, our PHP implementation of the web's fetch API that uses cURL to create asynchronous HTTP calls with promises., (*2)


Build status Code quality Code coverage Current version PHP.Gt/Curl documentation , (*3)

Example usage: Get a JSON object from a remote source, (*4)

When working with HTTP calls, it is extremely common to work with JSON. This library removes the need of a lot of boilerplate code by buffering the output of exec() calls for easy retrieval later with output() or outputJson()., (*5)

Example using PHP.Gt/Curl:

$curl = new Curl("https://catfact.ninja/fact");
$curl->exec();
$json = $curl->outputJson();
echo "Here's a cat fact: {$json->getString("fact")}";
echo PHP_EOL;
echo "The fact's length is {$json->getInt("length")} characters.";
echo PHP_EOL;

Same example using PHP's native curl_* functions:

// Using native functionality to achieve the same:
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://catfact.ninja/fact");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$result = curl_exec($ch);
if(false === $result) {
    die("CURL error: " . curl_error($ch));
}
$json = json_decode($result);
if(is_null($json)) {
    die("JSON decoding error: " . json_last_error_msg());
}

// Note: No type checks are made on the `fact` and `length` properties here.
echo "Here's a cat fact: {$json->fact}";
echo PHP_EOL;
echo "The fact's length is {$json->length} characters.";
echo PHP_EOL;

The Versions

30/07 2018

dev-master

9999999-dev

cURL object wrapper.

  Sources   Download

MIT

The Requires

  • php >=7.1.0
  • ext-curl *

 

The Development Requires

curl http interface curl_multi

28/07 2018

dev-4-buffer

dev-4-buffer

cURL object wrapper.

  Sources   Download

MIT

The Requires

  • php >=7.1.0
  • ext-curl *

 

The Development Requires

curl http interface curl_multi

27/07 2018

v2.2.3

2.2.3.0

cURL object wrapper.

  Sources   Download

MIT

The Requires

  • php >=7.1.0
  • ext-curl *

 

curl http interface curl_multi

27/07 2018

v2.2.2

2.2.2.0

cURL object wrapper.

  Sources   Download

MIT

The Requires

  • php >=7.1.0
  • ext-curl *

 

curl http interface curl_multi

26/07 2018

v2.1.0

2.1.0.0

cURL object wrapper.

  Sources   Download

MIT

The Requires

  • php >=7.1.0
  • ext-curl *

 

curl http interface curl_multi

26/07 2018

v2.2.1

2.2.1.0

cURL object wrapper.

  Sources   Download

MIT

The Requires

  • php >=7.1.0
  • ext-curl *

 

curl http interface curl_multi

26/07 2018

v2.2.0

2.2.0.0

cURL object wrapper.

  Sources   Download

MIT

The Requires

  • php >=7.1.0

 

curl http interface curl_multi

26/07 2018

v2.1.x-dev

2.1.9999999.9999999-dev

cURL object wrapper.

  Sources   Download

MIT

The Requires

  • php >=7.1.0

 

curl http interface curl_multi

25/07 2018

v2.x-dev

2.9999999.9999999.9999999-dev

cURL object wrapper.

  Sources   Download

MIT

The Requires

  • php >=7.1.0

 

curl http interface curl_multi

25/07 2018

v2.0.0

2.0.0.0

cURL object wrapper.

  Sources   Download

MIT

The Requires

  • php >=7.1.0

 

curl http interface curl_multi

04/02 2018

v1.1.0

1.1.0.0

PHP 7 interfaces for cURL object wrappers.

  Sources   Download

MIT

The Requires

  • php >=7.1.0

 

curl http interface curl_multi

10/12 2017

v1.0.0

1.0.0.0

PHP 7 interfaces for cURL object wrappers.

  Sources   Download

MIT

The Requires

  • php >=7.0.0

 

curl http interface curl_multi