Download the PHP package hiddeco/laravel-http-adapter without Composer
On this page you can find all versions of the php package hiddeco/laravel-http-adapter. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package laravel-http-adapter
Laravel HTTP Adapter (DEPRECATED)
Laravel HTTP Adapter is officialy deprecated. Use phphttp/laravel based upon httplug instead.
Laravel HTTP Adapter is an Ivory HTTP Adapter bridge, which integrates the ability of using multiple adapters with their own configuration through one API.
Installation
To use this package without running into trouble you will need PHP 5.5+ or HHVM 3.6+, and Composer.
-
Get the latest version of Laravel HTTP Adapter, add the following line to your composer.json file
"hiddeco/laravel-http-adapter": "0.1"
The package supports the following adapters, you will need to install the ones you want to use.
"ext-curl": "*"
"ext-http": "*"
"guzzle/guzzle": "^3.9.4@dev"
"guzzlehttp/guzzle": "^4.1.4|^5.0"
"kriswallsmith/buzz": "^0.13"
"nategood/httpful": "^0.2.17"
"zendframework/zendframework1": "^1.12.9"
"zendframework/zend-http": "^2.3.4"
-
Run
composer update
orcomposer install
-
Register the Laravel HTTP Adapter service provider in
config/app.php
by adding'HiddeCo\HttpAdapter\HttpAdapterServiceProvider'
to the providers key - Add the
HttpAdapter
facade to the aliases key:'HttpAdapter' => 'HiddeCo\HttpAdapter\Facades\HttpAdapter'
Configuration
To manage your HTTP adapters run the php artisan vendor:publish
command, this will create the config/httpadapter.php
file where you can modify and manage your adapter connections.
The following configuration options are available:
Global Configuration
The Global Configuration (global
) overrules all the other configurations set for your HTTP adapters. It accepts the
same parameters as an HTTP adapter connection does.
Default Connection Name
The adapter connection name set here (default
) is the default connection used for all requests. However, you may use as
many connections as you need using the manager class. The default setting is 'main'
.
HTTP Adapter Connections
This is the place to configure your HTTP adapter connections (connections
). A default configuration with possible
options is already present and there is no limit to the amount of connections.
The following adapters are available: buzz
, cake
, curl
, file_get_contents
, fopen
, guzzle
, guzzle_http
,
httpful
, react
, socket
, zend1
and zend2
.
Usage
HTTP Adapter Manager
The HttpAdapterManager
is where the magic happens. Bounded to the ioc container as httpadapter
and accessible by using the
Facade\HttpAdapter
facade. It uses parts of the Laravel Manager
package to manage the HTTP adapter connections. For more information about the Manager you should check out the respective
docs.
It is worth noting the connection returned will always be an instance of \Ivory\HttpAdapter\HttpAdapterInterface
. You
can find more information about this instance and its methods in the Ivory HTTP Adapter docs.
HTTP Adapter Facade
The HTTP Adapter facade will pass static method calls to the httpadapter
object in the ioc container, which as stated
before is the HttpAdapterManager
class.
Examples
The usage of this package is fairly simple. The main
connection is preconfigured and uses the file_get_contents
HTTP
adapter, no other configuration options are set for this connection by default.
Using the Facade
``
Using the HTTP Adapter Manager
The HTTPAdapterManager
returns an instance of \Ivory\HttpAdapter\HttpAdapterInterface
and will behave like it. If
you want to call a specific connection, you can use the connection
method:
``
Changing the default connection and further explanations:
``
Dependency Injection
Prefer the use of a dependency injection over facades? You can easily inject the manager:
``
Events
If you set the eventable
key in the general or local HTTP adapter configuration to true
the \Ivory\HttpAdapter\EventDispatcherHttpAdapter
will be used to make your HTTP adapter connection. This way it's possible to listen to events that are dispatched using
the Laravel dispatcher. All available events can be found in the Ivory HTTP docs.
``
It is also possible to register the event listener using the EventServiceProvider
.
License
Laravel HTTP Adapter is licensed under the MIT License (MIT).
All versions of laravel-http-adapter with dependencies
illuminate/contracts Version 5.0.*|5.1.*
illuminate/support Version 5.0.*|5.1.*
graham-campbell/manager Version ~2.2
egeloen/http-adapter Version 0.7.1