2017 © Pedro Peláez
 

library rikues

A simple cURL library for PHP.

image

krisanalfa/rikues

A simple cURL library for PHP.

  • Friday, April 22, 2016
  • by krisanalfa
  • Repository
  • 1 Watchers
  • 0 Stars
  • 7 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 0 % Grown

The README.md

Rikues

Rikues is a simple cURL library with serialization support., (*1)

Basic Usage

use Rikues\Rikues;

$rikues = new Rikues("https://httpbin.org/get");

$response = $rikues->send();

POST Request

use Rikues\Rikues;

$rikues = new Rikues("https://httpbin.org/post");

$rikues->withParam('foo', 'bar');
$rikues->withParam('baz', 'quux');

$rikues->withMethod('POST');

$response = $rikues->send();

Working With Headers

use Rikues\Rikues;

$rikues = new Rikues("https://httpbin.org/get");

$rikues->withHeader('Accept', 'application/json');
$rikues->withHeader('Authorization', 'Bearer xxx');

$response = $rikues->send();

Working With Query Params

use Rikues\Rikues;

$rikues = new Rikues("https://httpbin.org/get");

$rikues->withParam('foo', 'bar');
$rikues->withParam('baz', 'quux');

// Request to https://httpbin.org/get?foo=bar&baz=quux

$response = $rikues->send();

Working With Exception

use Rikues\Rikues;
use Rikues\Exceptions\ClientException;
use Rikues\Exceptions\ServerException;

$rikues = new Rikues("https://httpbin.org/get");

try {
    $response = $rikues->send();
} catch (ClientException $e) {
    echo $e->getMessage().PHP_EOL;
} catch (ServerException $e) {
    $serverResponse = $e->response;
}

Working With Serialization

$rikues = new Rikues("https://httpbin.org/post");

$rikues->withParam('foo', 'bar');
$rikues->withParam('baz', 'quux');

$rikues->withMethod('POST');

$serialized = serialize($rikues);

$unserialized = unserialize($serialized);

$response = $unserialized->send();

The Versions

22/04 2016

dev-master

9999999-dev

A simple cURL library for PHP.

  Sources   Download

MIT

The Development Requires

22/04 2016

0.0.3

0.0.3.0

A simple cURL library for PHP.

  Sources   Download

MIT

The Development Requires

22/04 2016

0.0.2

0.0.2.0

A simple cURL library for PHP.

  Sources   Download

MIT

The Development Requires

22/04 2016

0.0.1

0.0.1.0

A simple cURL library for PHP.

  Sources   Download

MIT

The Development Requires