Interact with web API in your projects

dev-master / 1.x-dev 2018-01-30 08:49 UTC


Build Status Coverage Status Scrutinizer Code Quality License composer.lock

Interact with web API in your projects.

curl-library uses a rolling release based on git master branch which is considered stable.




Open a command console, enter your project directory and execute the following command to download the latest stable version of this package:

$ composer require webeweb/curl-library "~1.0@dev"

This command requires you to have Composer installed globally, as explained in the installation chapter of the Composer documentation.


	// Initialize the POST request.
	$request = new CURLPostRequest(new CURLConfiguration(), "/resource-path");
	$request->addQueryData("id", 1);
	$request->addPostData("firstname", "John");
	$request->addPostData("lastname", "DOE");

	// Call the POST request.
	$response = $request->call();

	// Make something with the response.

Requests available :

  • CURLDeleteRequest
  • CURLGetRequest
  • CURLHeadRequest
  • CURLOptionsRequest
  • CURLPatchRequest
  • CURLPostRequest
  • CURLPutRequest


class MyCustomRequest extends AbstractCURLRequest {

	 * Constructor.
	 * @param CURLConfiguration $configuration The configuration.
	 * @param string $resourcePath The resource path.
	 * @throws InvalidHTTPMethodException Throws an invalid HTTP method exception if the method is not implemented.
	public function __construct(CURLConfiguration $configuration, $resourcePath) {
		parent::__construct(self::METHOD_GET, $configuration, $resourcePath); //



To test the package, is better to clone this repository on your computer. Open a command console and execute the following commands to download the latest stable version of this package:

$ mkdir curl-library
$ cd curl-library
$ git clone git@github.com:webeweb/curl-library.git .
$ composer install

Once all required libraries are installed then do:

$ vendor/bin/phpunit


curl-library is released under the LGPL License. See the bundled LICENSE file for details.