Download the PHP package innmind/http-transport without Composer

On this page you can find all versions of the php package innmind/http-transport. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package http-transport

HttpTransport

Build Status codecov Type Coverage

This library allows you to send http request.

Important: to use this library correctly you must use vimeo/psalm.

Installation

Usage

Send a request:

2xx responses will be on the right side of $either, all errors and other kinds of responses will be on the left side.

Important: you must call match to the returned Either otherwise the request will not be sent, but you can still call other methods on the Either before calling match.

Concurrency

By default there is no limit of concurrency for the Curl transport. But if you call many requests before unwrapping the results you may want to configure the max concurrency like below.

Let's say you have 100 urls to fetch, there will never be more than 5 requests being done in parallel.

Log the request

You can easily log all your requests like so:

Here a message is logged before the request is sent and another one once it's sent.

Exponential Backoff

Sometimes when calling an external API it may not be available due to heavy load, in such case you could retry the http call after a certain amount of time leaving time for the API to recover. You can apply this pattern like so:

By default it will retry 5 times the request if the server is unavailable, following the given periods (in milliseconds) between each call: 100, 271, 738, 2008 and 5459.

Circuit breaker

When a call to a certain domain fails you may want to all further calls to that domain to fail immediately as you know it means the host is down. Such pattern is called a circuit breaker.

This code will open the circuit for a given domain for 10 minutes in case a call results in a server error, after this delay the transport will let new request through as if nothing happened.

Follow redirections

By default the transports do not follow redirections to give you full control on what to do. But you can wrap your transport with FollowRedirections like this:

To avoid infinite loops it will follow up to 5 consecutive redirections.

Important: as defined in the rfc, requests with methods other than GET and HEAD that results in redirection with the codes 301, 302, 307 and 308 will NOT be redirected. It will be up to you to implement the redirection as you need to make sure such redirection is safe.


All versions of http-transport with dependencies

PHP Build Version
Package Version
Requires php Version ~8.2
ext-curl Version *
innmind/http Version ~7.0
innmind/filesystem Version ~7.1
innmind/stream Version ~4.0
psr/log Version ~3.0
ramsey/uuid Version ^4.7
innmind/time-warp Version ~3.0
innmind/time-continuum Version ~3.0
innmind/immutable Version ~4.15|~5.0
innmind/url Version ~4.0
innmind/io Version ~2.2
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package innmind/http-transport contains the following files

Loading the files please wait ....