2017 © Pedro Peláez
 

library easyhttp

An easier Http client for laravel

image

alimranahmed/easyhttp

An easier Http client for laravel

  • Saturday, May 5, 2018
  • by al_imran
  • Repository
  • 1 Watchers
  • 7 Stars
  • 4 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 1 Versions
  • 33 % Grown

The README.md

EasyHttp

Make Http request easily and log the request and response in Laravel's default log(/storage/logs)., (*1)

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., (*2)

Installation

Run the following command in your terminal while you are at the root of your project directory:, (*3)

composer require alimranahmed/easyhttp

That's all!, (*4)

Usages

By default all the request is made using Guzzle., (*5)

<?php
//For GET request
$response = Http::get('www.example.com/get');

//For POST Request
$data = ['key' => '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:, (*6)

<?php
Http::using('curl')->get('www.example.com/get');

License

This package is licensed under Apache License, Version 2.0, (*7)

The Versions

05/05 2018

dev-master

9999999-dev

An easier Http client for laravel

  Sources   Download

Apache-2.0

The Requires

 

The Development Requires

by Al Imran Ahmed

laravel http guzzle