This package is abandoned and no longer maintained. The author suggests using the chillerlan/php-httpinterface package instead.

A tiny cURL wrapper. PHP 7+

1.0.7 2018-04-15 03:02 UTC

This package is auto-updated.

Last update: 2019-08-05 17:26:36 UTC


A simple cURL wrapper, mostly for API scraping purposes.

version license Travis Coverage Scrunitizer Packagist downloads PayPal donate


  • No PSR-7!
  • No 87 extra layers of abstraction!
  • No fancy!

In case you're looking for that: go along, use Guzzle instead.




requires composer


You can simply clone the repo and run composer install in the root directory. In case you want to include it elsewhere, just add the following to your composer.json (note: replace dev-master with a version boundary):

	"require": {
		"php": ">=7.0.7",
		"chillerlan/php-curl": "dev-master"

Manual installation

Download the desired version of the package from master or release and extract the contents to your project folder. After that:

  • run composer install to install the required dependencies and generate /vendor/autoload.php.
  • if you use a custom autoloader, point the namespace chillerlan\TinyCurl to the folder src of the package




The most simple way:

use chillerlan\TinyCurl\{Request, URL};

$response = (new Request)->fetch(new URL('http://example.url/path'));

//do stuff
$json = $response->json;

Ways to set options:

use chillerlan\TinyCurl\{Request, RequestOptions, URL};

$options = new RequestOptions;
$options->ca_info = '/path/to/cacert.pem';

// while creating the Request instance
$request = new Request($options);

// on an existing Request instance:

// ...

The Request class also features a method to easily extract short URLs:

use chillerlan\TinyCurl\Request;

(new Request)->extractShortUrl('');


The RequestTrait is a somewhat stripped down variant to quick and easy implement. Using the trait in your own classes:

class MyClass{
	use RequestTrait;
	public function __construct(){
	public function doStuff(){
		$response = $this->fetch(new URL('https://example.url/path'));


The MultiRequest is an implementation of curl_multi a.k.a. "rolling cURL" to process multiple cURL requests in parallel, non-blocking. Please refer to the tests & examples and my GW2 database for further details on the implementation.

Properties of RequestOptions

property type default allowed description
$user_agent string 'chillerLAN-php-curl' * the user agent used for each request
$timeout int 10 * request timeout
$curl_options array [] [*] cURL options for each instance
$ca_info string null * path to a cacert
$max_redirects int 0 * maximum redirects

Properties of MultiRequestOptions

The MultiRequestOptions object extends RequestOptions with the following properties:

property type default allowed description
$handler string null * an optional handler FQCN (implements MultiResponseHandlerInterface)
$window_size int 5 * maximum of concurrent requests
$sleep int 100 * sleep timer (milliseconds) between each fired request on startup


I don't take responsibility for molten phone lines, bloated hard disks, self-induced DDoS, broken screens etc. Use at your own risk! ;)