2017 © Pedro Peláez
 

library wrapper

A php wrapper for RESTful apis

image

restful/wrapper

A php wrapper for RESTful apis

  • Thursday, April 3, 2014
  • by brianpilati
  • Repository
  • 1 Watchers
  • 0 Stars
  • 48 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 8 Versions
  • 0 % Grown

The README.md

restful-API-wrapper-php

Build Status, (*1)

Scrutinizer Code Quality, (*2)

Code Coverage, (*3)

A simple php RESTful api wrapper., (*4)

Code example

  $restful = new RESTful('https://<yourcompany>.com/<path>/<to>/<resource>', '<token>');
  $restful->post($path, $data);

Default Content-Type

The default Content-Type is application/json, (*5)

To change the default Content-Type, (*6)

  $restful->setContentType(<newContentType>);

Default URL Path Configuration and Authentication

The default URL Path is <baseURI>/<paht_to_data>/<token>/, (*7)

If you need to add a special configuration to the URL path, (*8)

  $restful->setPathConfiguration(<newPathConfiguration>);

Examples

Firebase needs a .json?auth= format., (*9)

  $restful = new RESTful('https://<yourcompany>.com/<path>/<to>/<resource>', '<token>');
  $restful->setPathConfiguration('.json?auth=');
  $restful->post($path, $data);

Header Authentication

To set the authentication in the header request, (*10)

  $restful->setHeaderProperty('<name_of_property>');

The full header property will be, (*11)

  '<name_of_property>: <token>'

List of Library Methods

delete($path) 
get($path) 
getHeaderLocation() 
getHeaderResponseCode() 
getResponseBody() 
patch($path, $data) 
post($path, $data) 
put($path, $data) 
setBaseURI($baseURI) 
setContentType($contentType) 
setHeaderProperty($headerProperty) 
setPathConfiguration($pathConfiguration) 
setTimeOut($seconds) 
setToken($token)

Unit Tests

All the unit tests are found in the "/tests" directory., (*12)

The RESTful tests can be executed by running the following command:, (*13)

All Tests

$ phpunit 

Test Groups

$ phpunit --group <groupName> 

Single Test

$ phpunit tests/unit/<file_name.php>

I started with the firebase-php library (https://github.com/ktamas77/firebase-php). Tamas' code is simply amazing! I helped him write the tests and the test stub. I reached out to him to fork and abstract the code but I never received a response., (*14)

-- Firebase PHP Class & Client Library --

https://github.com/ktamas77/firebase-php @author Tamas Kalman ktamas77@gmail.com, (*15)

The Versions

03/04 2014

dev-master

9999999-dev http://github.com/brianpilati/restful-api-wrapper-php

A php wrapper for RESTful apis

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

api rest wrapper

03/04 2014

v1.3.3

1.3.3.0 http://github.com/brianpilati/restful-api-wrapper-php

A php wrapper for RESTful apis

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

api rest wrapper

02/04 2014

v1.3.2

1.3.2.0 http://github.com/brianpilati/restful-api-wrapper-php

A php wrapper for RESTful apis

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

api rest wrapper

02/04 2014

v1.3.1

1.3.1.0 http://github.com/brianpilati/restful-api-wrapper-php

A php wrapper for RESTful apis

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

api rest wrapper

02/04 2014

v1.3.0

1.3.0.0 http://github.com/brianpilati/restful-api-wrapper-php

A php wrapper for RESTful apis

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

api rest wrapper

01/04 2014

v1.2.0

1.2.0.0 http://github.com/brianpilati/restful-api-wrapper-php

A php wrapper for RESTful apis

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

api rest wrapper

24/03 2014

v1.1.0

1.1.0.0 http://github.com/brianpilati/restful-api-wrapper-php

A php wrapper for RESTful apis

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

api rest wrapper

22/03 2014

v1.0.0

1.0.0.0 http://github.com/brianpilati/restful-api-wrapper-php

A php wrapper for RESTful apis

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

api rest wrapper