New

Just launched: Vueblocks, a brand-new search engine for Vue packages! Explore Vueblocks →

someline/rest-api-client

An elegant and smart Rest API Client with OAuth2 authentication support. Build for Laravel and Someline Starter.
13,527 8
Install
composer require someline/rest-api-client
Latest Version:v1.2.4
PHP:>=5.5.9
Laravel:5
License:MIT
Last Updated:Aug 12, 2019
Links: GitHub  ·  Packagist
Maintainer: libern

Someline Rest API Client

Latest Version Software License Total Downloads

Someline Starter API Client is an elegant and smart Rest API Client with OAuth2 authentication support.

Build for Laravel and Someline Starter.

It can be used for accessing APIs created using Someline Starter framework.

Install

Via Composer

Install composer package to your laravel project

composer require someline/rest-api-client

Add Service Provider to config/app.php

    'providers' => [
        ...
        Someline\Rest\RestClientServiceProvider::class,
        ...
    ],

Publishing config file.

php artisan vendor:publish

After published, config file for Rest Client is config/rest-client.php, you will need to config it to use Rest Client.

Usage

$restClient = new \Someline\Rest\RestClient('someline-starter');

$restClient->setOAuthUserCredentials([
    'username' => 'libern@someline.com',
    'password' => 'Abc12345',
]);
$restClient->withOAuthTokenTypeUser();

$response = $restClient->get("users")->getResponse();
if (!$restClient->isResponseStatusCode(200)) {
    $restClient->printResponseOriginContent();
    $responseMessage = $restClient->getResponseMessage();
    print_r($responseMessage);
} else {
    $responseData = $restClient->getResponseData();
    print_r($responseData);
}

Testing

phpunit

Contributing

Please see CONTRIBUTING for details.

Credits

License

The MIT License (MIT). Please see License File for more information.

Related Packages

laragear/api-manager

Manage multiple REST servers to make requests in few lines and fluently.

2,629 16
amanank/hal-client

A PHP client for interacting with HAL APIs.

2,324 0
imamnc/efihub-client

Laravel client for EFIHUB Integration Service

1,922 0
drparham/restfulapi

This Package leverages oauth2-server-laravel and laravel-cors packages, and adds...

6
roketin/connect

Roketin Engine API Client

415 0

Version History

Version Released PHP Laravel License
v1.2.4 >=5.5.9 5.2.*|5.3.*|5.4.*|5.5.*|5.6.*|5.7.*|5.8.* MIT
v1.2.3 >=5.3.0 5.2.*|5.3.*|5.4.*|5.5.*|5.6.*|5.7.*|5.8.* MIT
v1.2.2 >=5.3.0 5.2.*|5.3.*|5.4.*|5.5.*|5.6.* MIT
v1.2.1 >=5.3.0 5.2.*|5.3.*|5.4.*|5.5.* MIT
v1.1.6 >=5.3.0 5.2.*|5.3.*|5.4.* MIT