Download the PHP package fansipan/peak without Composer

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

Peak

Latest Version on Packagist Github Actions Codecov Total Downloads

A simple and efficient solution for concurrently sending HTTP requests using PSR-18 client implementations.

Peak is a library that enables concurrent request sending using a request pool. It leverages the event loop of AMPHP, ReactPHP or PSL to handle and manage the requests concurrently.

Requirements

Installation

You can install the package via composer:

Additionally, depending on your choice of driver, these packages may also need to be installed.

AMPHP

PSL

ReactPHP

Usage

Create Request Pool

Typical applications would use the PoolFactory class to create a pool.

It will attempt to create async version of the client using AsyncClientFactory. The supported clients are Guzzle and Symfony HTTPClient (Psr18Client).

You can use any PSR-18 client implementations with ReactPHP driver. If an unsupported client is used, it will be replaced with the Browser HTTP client (require react/http installed).

The Fansipan\Peak\PoolFactory provides a configured request pool based on the installed packages, which is suitable for most cases. However, if desired, you can specify a particular implementation if it is available on your platform and/or in your application.

First, you need to create your desired driver:

Then create an asynchronous client, which is essentially a decorator for the PSR-18 client:

Sending Requests

The send method accepts an iterator of PSR-7 requests or closures/invokable class which receive an Psr\Http\Client\ClientInterface instance.

Retrieving Responses

As you can see from the example above, each response instance can be accessed using an index. However, the response order is not guaranteed. If you wish, you can assign names to the requests to easily track the specific requests that have been sent. This allows you to access the corresponding responses by their assigned names.

Concurrency Limit

Sending an excessive number of requests may either take up all resources on your side or it may even get you banned by the remote side if it sees an unreasonable number of requests from your side.

As a consequence, it's usually recommended to limit concurrency on the sending side to a reasonable value. It's common to use a rather small limit, as doing more than a dozen of things at once may easily overwhelm the receiving side.

You can use concurrent method to set the maximum number of requests to send concurrently. The default value is 25.

Additional requests that exceed the concurrency limit will automatically be enqueued until one of the pending requests completes.

Testing

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CODE_OF_CONDUCT for details.

Security

If you discover any security related issues, please email [email protected] instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.


All versions of peak with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
psr/http-client Version ^1.0
psr/http-factory Version ^1.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 fansipan/peak contains the following files

Loading the files please wait ....