Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/alimranahmed/easyhttp
A Laravel HTTP-client to make HTTP request easier and log requests and responses
https://github.com/alimranahmed/easyhttp
composer curlphp guzzlehttp http-client laravel laravel5 php7
Last synced: about 1 month ago
JSON representation
A Laravel HTTP-client to make HTTP request easier and log requests and responses
- Host: GitHub
- URL: https://github.com/alimranahmed/easyhttp
- Owner: alimranahmed
- License: apache-2.0
- Archived: true
- Created: 2018-05-05T04:04:03.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2019-05-29T13:35:55.000Z (over 5 years ago)
- Last Synced: 2024-09-27T19:03:25.289Z (about 1 month ago)
- Topics: composer, curlphp, guzzlehttp, http-client, laravel, laravel5, php7
- Language: PHP
- Homepage: https://packagist.org/packages/alimranahmed/easyhttp
- Size: 34.2 KB
- Stars: 21
- Watchers: 3
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# EasyHttp
Make Http request easily and log the request and response in Laravel's default log(/storage/logs).This Laravel 5 HTTP-client package to make HTTP request easier. It's a wrap on Guzzle HTTP client and cURL that simplify the common
requests. We can use Guzzle or cURL whatever we want on run time of this package.## Installation
Run the following command in your terminal while you are at the root of your project directory:```
composer require alimranahmed/easyhttp
```That's all!
## Usages
By default all the request is made using Guzzle.
```php
'value'];
$headers = ['Content-Type' => 'application/json'];
$response = Http::post('www.example.com/post', $data, $headers);
//For PUT request
$data = ['key' => 'value'];
$headers = ['Content-Type' => 'application/json'];
$response = Http::put('www.example.com/put', $data, $headers);
//For DELETE request
$response = Http::delete('www.example.com/delete');
//To Retrieve the response status, header and body
$response->getStatusCode(); //for status code
$response->getHeaders(); //for headers
$response->contents; //for body
```To make any request using cURL we can simply use the `using()` method as below:
```php
get('www.example.com/get');
```## License
This package is licensed under [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0)