2017 © Pedro Peláez
 

library php-rest-client

A PHP REST Client.

image

softiciel/php-rest-client

A PHP REST Client.

  • Thursday, July 6, 2017
  • by jaenmedina
  • Repository
  • 1 Watchers
  • 1 Stars
  • 3 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 0 % Grown

The README.md

PHP REST Client

Build Status Codacy Badge Code Climate, (*1)

A PHP REST Client., (*2)

Version

0.1.0, (*3)

Install with composer

Add the package dependency softiciel/php-rest-client in your composer.json, (*4)

{
    "require": {
        "softiciel/php-rest-client": "0.3.0"
    }
}

How to use?

Just instantiate the method you want to execute. There is support for GET, POST, PUT HEAD, DELETE and OPTIONS methods., (*5)

For GET method:, (*6)

$url = 'http://www.example.com';
$getMethod = new Get($url);
$result = $getMethod->execute();
print_r($result); // Will print the array with keys 'status', 'time', 'header', 'body' and 'error'.

For POST method:, (*7)

$url = 'https://httpbin.org/post';
$postMethod = new Post($url);
$postMethod->setParameter('text', 'Read these tips to improve');
$result = $postMethod->execute();
print_r($result); // Will print the array with keys 'status', 'time', 'header', 'body' and 'error'.

For PUT method:, (*8)

$url = 'https://httpbin.org/put';
$putMethod = new Put($url);
$data = 'Test data';
$result = $putMethod->execute($data);
print_r($result); // Will print the array with keys 'status', 'time', 'header', 'body' and 'error'.

For HEAD method:, (*9)

$url = 'http://www.example.com';
$headMethod = new Head($url);
$result = $headMethod->execute();
print_r($result); // Will print the array with keys 'status', 'time', 'header', and 'error'.

For OPTIONS method:, (*10)

$url = 'http://www.example.com';
$optionsMethod = new Options($url);
$result = $optionsMethod->execute();
print_r($result); // Will print the array with keys 'status', 'time', 'header', 'body' and 'error'

For DELETE method:, (*11)

$url = 'https://httpbin.org/DELETE';
$deleteMethod = new Delete($url);
$result = $deleteMethod->execute();
print_r($result); // Will print the array with keys 'status', 'time', 'header', 'body' and 'error'

For custom method:, (*12)

$url = 'http://www.example.com';
$customMethod = new CustomMethod($url);
$result = $customMethod->execute('EXECUTE');
print_r($result); // Will print the array with keys 'status', 'time', 'header', 'body' and 'error'

You can also use the RestClient class:, (*13)

$result = RestClient::execute([
    'method' => 'get',
    'url' => 'www.example.org'
]);
print_r($result); // Will print the array with keys 'status', 'time', 'header', 'body' and 'error'

License

MIT, (*14)

The Versions

06/07 2017

dev-master

9999999-dev

A PHP REST Client.

  Sources   Download

MIT

The Requires

  • php >=5.4

 

The Development Requires

by Jaen Medina

curl php rest http client

06/07 2017

0.3.0

0.3.0.0

A PHP REST Client.

  Sources   Download

MIT

The Requires

  • php >=5.4

 

The Development Requires

by Jaen Medina

curl php rest http client

29/05 2017

0.2.0

0.2.0.0

A PHP REST Client.

  Sources   Download

MIT

The Requires

  • php >=5.4

 

The Development Requires

by Jaen Medina

curl php rest http client

23/04 2015

0.1.0

0.1.0.0

A PHP REST Client.

  Sources   Download

MIT

The Requires

  • php >=5.4

 

The Development Requires

by Jaen Medina

curl php rest http client