php-http / laravel-httplug
Laravel package to integrate the Httplug generic HTTP client into Laravel
Installs: 110 046
Dependents: 1
Suggesters: 0
Security: 0
Stars: 12
Watchers: 8
Forks: 3
Open Issues: 5
Requires
- php: ^5.5 || ^7.0
- illuminate/support: ~5
- php-http/cache-plugin: ^1.0
- php-http/client-common: ^1.2
- php-http/logger-plugin: ^1.0
- php-http/message: ^1.3
Requires (Dev)
- friendsofphp/php-cs-fixer: 1.9.*
- graham-campbell/testbench: ^3.1
- php-http/buzz-adapter: ^0.3
- php-http/curl-client: ^1.0
- php-http/guzzle6-adapter: ^1.1.1
- php-http/react-adapter: ^0.2.1
- php-http/socket-client: ^1.0
- phpunit/phpunit: ^4.5 || ^5.4
- sllh/php-cs-fixer-styleci-bridge: ^1.5
This package is auto-updated.
Last update: 2024-12-05 18:16:05 UTC
README
Install
Via Composer
$ composer require php-http/laravel-httplug
With Laravel 5.5 or newer, the package will be discovered automatically.
If you're using an older version of Laravel, add the following to your
config/app.php
:
<?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.