Download the PHP package api-clients/transport without Composer
On this page you can find all versions of the php package api-clients/transport. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download api-clients/transport
More information about api-clients/transport
Files in api-clients/transport
Package transport
Short Description Middleware infused clue/buzz-react
License MIT
Informations about the package transport
API Client Transport for PHP 7.x
In a nutshell this package is a wrapper around clue/buzz-react
adding middleware.
Install
To install via Composer, use the command below, it will automatically detect the latest version and bind it with ^
.
Usage
Creating the client can be done using the factory:
Next you can make PSR-7 request:
Middleware
Middlewares are passed into the client with the options argument. In this example the api-clients/middleware-delay
is used. Adding middlewares to the client is simple, add an array to $options
with Options::MIDDLEWARE
as index cosisting of middleware class names. Optionally you can pass options for the middleware through the $options
array. Simply add a new array inside the array with the middlware class name as index and pass the desired options into it.
Middleware options can be changed per request, this specific request only will have a delay of 5 seconds instead of the default 3:
Options
Options::DNS
DNS server to use resolving hostnames, defaults to 8.8.8.8
.
Options::SCHEMA
Schema part of the URI, defaults to https
.
Options::HOST
Host part of the URI, required.
Options::PORT
Port part of the URI, optional.
Options::PATH
Path part of the URI, defaults to /
.
Options::HEADERS
Key value array with headers, defaults to []
.
Options::MIDDLEWARE
Array with middleware class names, for example [MiddlewareOne::class, MiddlewareTwo::class]
, defaults to []
.
Options::DEFAULT_REQUEST_OPTIONS
Set of default request options, mainly useful for middlewares needed for all requests, defaults to []
.
License
The MIT License (MIT)
Copyright (c) 2017 Cees-Jan Kiewiet
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
All versions of transport with dependencies
api-clients/middleware Version ^4.0
api-clients/rx Version ^2.0
clue/buzz-react Version ^2.0 || ^1.4
react/event-loop Version ^1.0 || ^0.5 || ^0.4
react/http-client Version ^0.4.17 || ^0.5
react/promise-stream Version ^1.0 || ^0.1.0