Download the PHP package react/http-client without Composer

On this page you can find all versions of the php package react/http-client. 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-client

Deprecation notice

This package has now been migrated over to react/http and only exists for BC reasons.

If you've previously used this package, upgrading may take a moment or two. The new API has been updated to use Promises and PSR-7 message abstractions. This means it's now more powerful and easier to use than ever:

See react/http for more details.

The below documentation applies to the last release of this package. Further development will take place in the updated react/http, so you're highly recommended to upgrade as soon as possible.

Deprecated HttpClient

Build Status

Event-driven, streaming HTTP client for ReactPHP.

Table of Contents

Basic usage

Client

The Client is responsible for communicating with HTTP servers, managing the connection state and sending your HTTP requests. It also registers everything with the main EventLoop.

If you need custom connector settings (DNS resolution, TLS parameters, timeouts, proxy servers etc.), you can explicitly pass a custom instance of the ConnectorInterface:

The request(string $method, string $uri, array $headers = array(), string $version = '1.0'): Request method can be used to prepare new Request objects.

The optional $headers parameter can be used to pass additional request headers. You can use an associative array (key=value) or an array for each header value (key=values). The Request will automatically include an appropriate Host, User-Agent: react/alpha and Connection: close header if applicable. You can pass custom header values or use an empty array to omit any of these.

The Request#write(string $data) method can be used to write data to the request body. Data will be buffered until the underlying connection is established, at which point buffered data will be sent and all further data will be passed to the underlying connection immediately.

The Request#end(?string $data = null) method can be used to finish sending the request. You may optionally pass a last request body data chunk that will be sent just like a write() call. Calling this method finalizes the outgoing request body (which may be empty). Data will be buffered until the underlying connection is established, at which point buffered data will be sent and all further data will be ignored.

The Request#close() method can be used to forefully close sending the request. Unlike the end() method, this method discards any buffers and closes the underlying connection if it is already established or cancels the pending connection attempt otherwise.

Request implements WritableStreamInterface, so a Stream can be piped to it. Interesting events emitted by Request:

Response implements ReadableStreamInterface. Interesting events emitted by Response:

Example

See also the examples.

Advanced Usage

Unix domain sockets

By default, this library supports transport over plaintext TCP/IP and secure TLS connections for the http:// and https:// URI schemes respectively. This library also supports Unix domain sockets (UDS) when explicitly configured.

In order to use a UDS path, you have to explicitly configure the connector to override the destination URI so that the hostname given in the request URI will no longer be used to establish the connection:

See also example #11.

Install

The recommended way to install this library is through Composer. New to Composer?

This will install the latest supported version:

See also the CHANGELOG for details about version upgrades.

This project aims to run on any platform and thus does not require any PHP extensions and supports running on legacy PHP 5.3 through current PHP 7+ and HHVM. It's highly recommended to use PHP 7+ for this project.

Tests

To run the test suite, you first need to clone this repo and then install all dependencies through Composer:

To run the test suite, go to the project root and run:

The test suite also contains a number of functional integration tests that send test HTTP requests against the online service http://httpbin.org and thus rely on a stable internet connection. If you do not want to run these, they can simply be skipped like this:

License

MIT, see LICENSE file.


All versions of http-client with dependencies

PHP Build Version
Package Version
Requires php Version >=5.3.0
evenement/evenement Version ^3.0 || ^2.0 || ^1.0
react/event-loop Version ^1.0 || ^0.5 || ^0.4 || ^0.3
react/promise Version ^2.1 || ^1.2.1
react/socket Version ^1.0 || ^0.8.4
react/stream Version ^1.0 || ^0.7.1
ringcentral/psr7 Version ^1.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 react/http-client contains the following files

Loading the files please wait ....