daxvir/restclient

An elegant and smart Rest API Client with OAuth2 authentication support for laravel

v1.3 2020-03-11 04:29 UTC

This package is auto-updated.

Last update: 2024-06-11 14:04:37 UTC


README

An elegant and smart Rest API Client with OAuth2 authentication support for laravel

Install

Via Composer

Install composer package to your laravel project

composer require daxvir/restclient

Usage

Sample use case for rest client assuming config contains valid client credentials

$client = new RestClient();
$response = $client->get("packages")->getResponse();
if (!$client->isResponseStatusCode(200)) {
    $client->printResponseOriginContent();
    $responseMessage = $client->getResponseMessage();
    print_r($responseMessage);
} else {
    $response = $client->getResponseData();
    dd($response);
}