Download the PHP package strictphp/http-clients without Composer

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

HTTP Clients

The HTTP Clients package provides a collection of HTTP clients that can be used to manage HTTP requests and responses in your PHP application. The package includes a ClientsFactory to simplify the creation of clients by allowing you to define a list of ClientFactoryContract implementations.

Features

Integration

Installation

You can install the HTTP Clients package via Composer:

Usage

The ClientsFactory simplifies the creation of clients by allowing you to define a list of ClientFactoryContract implementations with dependency injection.

Example:

These examples demonstrate how to efficiently manage HTTP requests and responses in your PHP application using the provided HTTP client classes and the ClientsFactory.

ConfigManager

Config manager is designed for setting different configuration per host (IP, domain). Each HTTP client can contain Config class in their namespace.

Setting up default configuration

Setting up override for given domain

You should set your DI container to provide ConfigManager as a singleton.

Clients

CacheResponseClient (file)

The CacheResponseClient utilizes PSR-6 (simple-cache) for caching responses, improving development speed by serving cached responses for subsequent requests. Here are some benefits and considerations:

CustomizeRequestClient (file)

Alter request before sending it to the HTTPClient. You can throw ClientExceptionInterface. This client could be useful for testing error handling mechanisms in your application and use cached *.shttp file.

CustomResponseClient (file)

Subject to change.

You can define custom response file foe each host.

The #1 parameter in constructor can be:

EventClient (file)

dependent on PSR-14 (event-dispatcher)

You can attach events before, failed or request success. It is useful for logging.

MainHttpClient (file)

This is first endpoint for debugging. If you use ClientsFactory, this instance will be returned.

MockClient (file)

MockClient use for tests, you define response for current scope.

RetryClient (file)

Retry client is designed to retry failed request with ability to define number of tries and allowlist (based on exception).

SleepClient (file)

The SleepClient allows you to introduce a wait interval between requests, which may be necessary for interacting with external APIs that require rate limiting.

StoreClient (file)

The StoreClient saves request and response, without dependency on PSR-14

Testing

You can save file with extension *.shttp by MockClient.

Write your own client

You can write your own client simply by implementing these interfaces:

Below is an example of an implementation:

Config

Client

ClientFactory


All versions of http-clients with dependencies

PHP Build Version
Package Version
Requires php Version >=8.2
guzzlehttp/psr7 Version ^2.5
illuminate/filesystem Version ^9.0 || ^10.0 || ^11.0 || ^12.0
psr/container Version ^2.0
psr/event-dispatcher Version ^1.0
psr/http-client Version ^1.0
psr/http-message Version ^1.0 || ^2.0
psr/log Version ^3.0
psr/simple-cache Version ^3.0
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 strictphp/http-clients contains the following files

Loading the files please wait ....