bca/curl

cURL wrapper for PHP applications.

Installs: 8 959

Dependents: 1

Stars: 6

Watchers: 1

Forks: 159

Language: JavaScript

2.2.1 2014-09-17 19:19 UTC

README

Work with remote servers via cURL much easier than using the native PHP bindings.

Build Status Dependencies Status Coverage Status SensioLabsInsight

Latest Stable Version Total Downloads License

Requirements

  1. PHP 5.3+
  2. libcurl

Features

  • POST/GET/PUT/DELETE requests over HTTP
  • HTTP Authentication
  • Follows redirects
  • Returns error string
  • Provides debug information
  • Cookies

Install

Using Composer

Just add the following to the require section your composer.json file:

"bca/curl": "2.*"

Then execute composer install to pull down the latest release.

Package details can be found at https://packagist.org/packages/bca/curl.

Manually via Github

You may download a specific version from https://github.com/brodkinca/BCA-PHP-CURL/tags or visit the main repository at https://github.com/brodkinca/BCA-PHP-CURL/tree/master to download unreleased code or pull down a copy via git.

Versioning

This library will be maintained under the Semantic Versioning guidelines.

Releases will be numbered with the following format:

<major>.<minor>.<patch>

And constructed with the following guidelines:

  • Breaking backward compatibility bumps the major (and resets the minor and patch)
  • New additions without breaking backward compatibility bumps the minor (and resets the patch)
  • Bug fixes and misc changes bump the patch

Composer users who would like more granular control over upgrades should restrict their installation to patch updates only using this require key:

"bca/curl": "2.1.*"

For more information on SemVer, please visit http://semver.org/.

Examples

Simple requests can be constructed with just a URL and a method.

$request = new CURL('http://example.com/');
$response = $request->get();

More complex requests build upon that concept by adding methods to the request.

$request = new CURL('http://example.com/');
$response = $request
    ->param('aaa', 'bbb')
    ->param('xxx', 'yyy')
    ->post();

echo $response;

Advanced requests can be built by adding even more methods.

$request = new CURL('http://example.com/');
$response = $request
    ->param('aaa', 'bbb')
    ->param('xxx', 'yyy')
    ->option(CURLOPT_PROXY, '10.0.0.1')
    ->auth('username', 'password', 'digest')
    ->delete();

echo $response;