enathan / laravel-http-rest-client
Simple REST client for Laravel
Installs: 2 599
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 1
Forks: 2
Open Issues: 0
This package is not auto-updated.
Last update: 2024-11-13 07:33:40 UTC
README
Simple HTTP rest client for Laravel by eNathan
Installation via Composer
Add the following to your composer.json
's dependency list:
"require": {
"enathan/laravel-http-rest-client"
}
Update Composer
In the root directory of your Laravel project (where composer.json
is located), run:
composer update
Add Service Provider
Open config/app.php
and add the following line to the providers
array:
$providers => [
... ,
'App\Providers\LaravelHttpRestClient'
];
Usage
The RestClient is a singleton registered in Laravel's IoC as HttpRestClient
. You can access the rest client by using \App::make('HttpRestClient')
.
Example
$RestClient = \App::make('HttpRestClient');
$response = $RestClient->get('http://my_rest_server.com/',
array(
'username': 'foo',
'password': 'bar
)
);