kfreiman/restful

Client for RESTful APIs, based on Guzzle's Client

dev-master 2016-01-15 13:41 UTC

This package is not auto-updated.

Last update: 2024-11-13 19:35:31 UTC


README

It is HTTP-client with main focus to the standart RESTful API.

##Improvements, regarding the the Guzzle's Client:

Substitution params in URI by tokens

<?php
require 'vendor/autoload.php';

$client = new \kfreiman\restful\RestfulClient(
    [
        'base_uri' => 'https://api.example.com/3.0/',
        'headers' => [
            'Authorization' => 'Bearer my_token',
        ]
    ]
);

$responce = $client->get('lists/{list_id}/user/{user_id}', [
        'list_id' => 123,
        'user_id' => 1,
    ]);

$result = $responce->getBody()->getContents();

var_dump($result); // user object