phpwrapper / curl
cURL wrapper
dev-master
2016-02-04 12:02 UTC
Requires
- php: ^5.6|^7.0
Requires (Dev)
- artfocus/codestyle: ^2.0
- phpunit/phpunit: ^5.1
- squizlabs/php_codesniffer: ^2.5
This package is not auto-updated.
Last update: 2024-10-12 19:55:00 UTC
README
PhpWrapper\Curl
Simple cURL wrapper.
Installation
$ composer require phpwrapper/curl dev-master
Usage
<?php use PhpWrapper\Curl; // Init factory with default options $curlFactory = new Curl\CurlFactory([ [CURLOPT_SSL_VERIFYPEER, TRUE], [CURLOPT_SSL_VERIFYHOST, TRUE], ]); // Create and setup cURL $curl = $curlFactory->create('https://api.example.com/v1'); $curl->addHeader('Accept: application/json'); $curl->addParameter('myKey', 'myValue'); /** @var Curl\Response $response */ $response = $curl->get(); // or $response = $curl->post(); // or $response = $curl->put(); // or $response = $curl->delete(); // Process response var_dump($response->getStatus()); var_dump($response->getHeaders()); var_dump($response->getBody());