php-http / laravel-httplug by dbu

Laravel package to integrate the Httplug generic HTTP client into Laravel
110,046
12
8
Package Data
Maintainer Username: dbu
Maintainer Contact: mathieu.santostefano@gmail.com (Mathieu Santo Stefano--Féron)
Package Create Date: 2016-02-19
Package Last Update: 2020-06-05
Language: PHP
License: MIT
Last Refreshed: 2024-11-23 03:13:00
Package Statistics
Total Downloads: 110,046
Monthly Downloads: 2
Daily Downloads: 0
Total Stars: 12
Total Watchers: 8
Total Forks: 3
Total Open Issues: 5

Laravel-Httplug

Latest Version Software License Build Status Code Coverage Quality Score Total Downloads

Install

Via Composer

$ composer require php-http/laravel-httplug

Add serviceprovider and alias

<?php
// config.app

'providers' => [
    ...,
    ...,

     Http\Httplug\HttplugServiceProvider::class,

],

'aliases' => [
    ...,
    ...,

    'Httplug'   => Http\Httplug\Facade\Httplug::class,

],


Publish the package config file to config/httplug.php:

php artisan vendor:publish --provider="Http\Httplug\HttplugServiceProvider"

Usage

<?php

// Create a request using a MessageFactory
$factory = app()->make('httplug.message_factory.default');
$request = $factory->createRequest('GET', 'http://httpbin.org');

$httplug = app()->make('httplug');

// Send request with default driver
$response = $httplug->sendRequest($request);

// Send request with another driver
$response = $httplug->driver('curl')->sendRequest($request);

// Send request with default driver using facade
$response = Httplug::sendRequest($request);

// Send request with another driver using facade
$response = Httplug::driver('curl')->sendRequest($request)

Testing

$ composer test

Contributing

Please see our contributing guide.

Security

If you discover any security related issues, please contact us at security@php-http.org.

License

The MIT License (MIT). Please see License File for more information.