flexyproject / curl
This package is abandoned and no longer maintained.
The author suggests using the php-http/httplug package instead.
A PHP7 object-oriented wrapper of the cURL extension
1.1.3
2016-08-20 23:53 UTC
Requires
- php: >=7
- ext-curl: *
README
This is a PHP7 object-oriented wrapper of the cURL extension.
Installation
composer require flexyproject/curl
Usage
require 'vendor/autoload.php'; use \FlexyProject\Curl\Client; // Create Client object $curl = new Client(); // Set Url $curl->setUrl('https://api.github.com/user'); // Set options (here authentication options) $curl->setOption([ CURLOPT_HTTPAUTH => CURLAUTH_BASIC, CURLOPT_USERPWD => sprintf('%s:%s', 'user', 'pass') ]); // Success callback $curl->success(function (Client $instance) { $instance->getHeaders(); // Get headers info $instance->getResponse(); // Get response body }); // Error callback $curl->error(function (Client $instance) { $instance->getHeaders(); // Get headers info $instance->getResponse(); // Get response body }); // Perform request $curl->perform();