2017 © Pedro Peláez
 

library curl

curl wrapper

image

firmaprofesional/curl

curl wrapper

  • Monday, April 16, 2018
  • by firmarpofesional
  • Repository
  • 0 Watchers
  • 0 Stars
  • 559 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 7 Versions
  • 63 % Grown

The README.md

PHP Curl Class

This library provides an object-oriented wrapper of the PHP cURL extension., (*1)

If you have questions or problems with installation or usage create an Issue., (*2)

Installation

In order to install this library via composer run the following command in the console:, (*3)

composer require firmaprofesional/curl

or add the package manually to your composer.json file in the require section:, (*4)

"firmaprofesional/curl": "^0.3"

Usage examples

$curl = new CurlService();
$curlConfig = new CurlConfig();
$curlConfig->setCurlUrl('www.example.com');
$curl->configure($curlConfig);
$curl->send();

basic authentication, (*5)

$curl = new CurlService();
$curlConfig = new CurlConfig();
$curlConfig->setCurlUrl('www.example.com');
$curlConfig->setUsername('user');
$curlConfig->setUserPassword('password');
$curl->configure($curlConfig);
$curl->send();

post fields, (*6)


$curl = new CurlService(); $curlConfig = new CurlConfig(); $curlConfig->setCurlUrl('www.example.com'); $curlConfig->setMethodPOST(); $data_string = json_encode(array('data')); $curlConfig->setHttpHeader( array( 'Content-Type: application/json', 'Content-Length: ' . strlen($data_string), ) ); $curlConfig->setData($data_string); $curl->configure($curlConfig); $curl->send();

post fields with bearer token authentication, (*7)


$curl = new CurlService(); $curlConfig = new CurlConfig(); $curlConfig->setCurlUrl('www.example.com'); $curlConfig->setMethodPOST(); $data_string = json_encode(array('data')); $curlConfig->setHttpHeader( array( 'Content-Type: application/json', 'Content-Length: ' . strlen($data_string), 'Authorization: Bearer bearertoke' ) ); $curlConfig->setData($data_string); $curl->configure($curlConfig); $curl->send();

enable verbose mode will log on tmp path, (*8)


$curl = new CurlService(); $curlConfig = new CurlConfig(); $curlConfig->setCurlUrl('www.example.com'); $curlConfig->setVerbose(true); $curl->configure($curlConfig); $curl->send();

set timeout in seconds, (*9)


$curl = new CurlService(); $curlConfig = new CurlConfig(); $curlConfig->setCurlUrl('www.example.com'); $curlConfig->setTimeout(10); $curl->configure($curlConfig); $curl->send();

Testing

In order to test the library:, (*10)

  1. Create a fork
  2. Clone the fork to your machine
  3. Install the depencies composer install
  4. Run the unit tests ./vendor/phpunit/bin/phpunit -c phpunit.xml --testsuite general

The Versions

16/04 2018

dev-master

9999999-dev https://github.com/firmaprofesional/curl

curl wrapper

  Sources   Download

MIT

The Requires

 

The Development Requires

by Dev Team

curl firmaprofesional

16/04 2018

0.5.1

0.5.1.0 https://github.com/firmaprofesional/curl

curl wrapper

  Sources   Download

MIT

The Requires

 

The Development Requires

by Dev Team

curl firmaprofesional

16/04 2018

dev-logger-error

dev-logger-error https://github.com/firmaprofesional/curl

curl wrapper

  Sources   Download

MIT

The Requires

 

The Development Requires

by Dev Team

curl firmaprofesional

16/04 2018

0.5

0.5.0.0 https://github.com/firmaprofesional/curl

curl wrapper

  Sources   Download

MIT

The Requires

 

The Development Requires

by Dev Team

curl firmaprofesional

16/04 2018

dev-add-delete-method

dev-add-delete-method https://github.com/firmaprofesional/curl

curl wrapper

  Sources   Download

MIT

The Requires

 

The Development Requires

by Dev Team

curl firmaprofesional

21/03 2018

0.4

0.4.0.0 https://github.com/firmaprofesional/curl

curl wrapper

  Sources   Download

MIT

The Requires

 

The Development Requires

by Dev Team

curl firmaprofesional

23/02 2018

0.3

0.3.0.0 https://github.com/firmaprofesional/curl

curl wrapper

  Sources   Download

MIT

The Requires

 

The Development Requires

by Dev Team

curl firmaprofesional