Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dangdungcntt/laravel-http-client
https://github.com/dangdungcntt/laravel-http-client
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/dangdungcntt/laravel-http-client
- Owner: dangdungcntt
- License: mit
- Created: 2019-01-10T22:21:31.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2019-04-18T14:11:18.000Z (over 5 years ago)
- Last Synced: 2024-08-18T01:12:26.849Z (5 months ago)
- Language: PHP
- Size: 5.86 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Guzzle Wrapper for laravel
## Installation
You can install the package via composer:
```bash
composer require nddcoder/laravel-http-client
```## Usage
#### Inject HttpClient into Controller Contructor
```php
use Nddcoder\HttpClient\HttpClient;class TodoController extends Controller
{
private $http;public function __construct(HttpClient $http)
{
$this->http = $http;
}public function index()
{
return $this->http->get('https://jsonplaceholder.typicode.com/todos');
/*
{
"status_code": 200,
"headers": {},
"body": "...",
"bodyJSON": [...]
}
*/
}
}
```## License
The MIT License (MIT). Please see [License File](LICENSE.md) for more information.