2017 © Pedro Peláez
 

library rest-api-wrapper

A Curl Wrapper for RESTful APIs

image

mega6382/rest-api-wrapper

A Curl Wrapper for RESTful APIs

  • Monday, December 4, 2017
  • by mega6382
  • Repository
  • 2 Watchers
  • 0 Stars
  • 4 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

restApiWrapper

A Curl Wrapper for RESTful APIs, (*1)

To Install use composer:, (*2)

composer require mega6382/rest-api-wrapper

Quick Examples

Create a restApiWrapper instance

$url = "https://example.com/";
$raw = new raw\restApiWrapper($url);

Send a POST Request, with Params, Custom Headers and Return type Json Object

$request = $raw->post(
            'ufkbi1uf', // Endpoint to the API
            [ //POST Params
                'param1' => 'abc',
                'param2' => 'def',
                'param3' => 'ghi',
            ],
            [ //Request Headers 
                'Content-Type: application/xml',
                'Connection: Keep-Alive'
            ],
            'json' //Return type
        );
var_dump($request);

Send a GET Request, without any Params or Custom Headers and return String

$request = $raw->get('ufkbi1uf', [], [], '');
var_dump($request);

Send a OPTIONS Request, with Params, but no Custom headers and return will be a string

$request = $raw->options('ufkbi1uf', ['name' => 'basil'], [], '');
var_dump($request);

The Versions

04/12 2017

dev-master

9999999-dev

A Curl Wrapper for RESTful APIs

  Sources   Download

GPL

by Haseeb A. Basil