Download the PHP package kiwilan/php-http-pool without Composer

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

PHP HTTP Pool

Banner with cards catalog picture in background and PHP XML Reader title

php version downloads license tests codecov

PHP package with easy-to-use GuzzleHttp pool wrapper, works with GuzzleHttp\Pool and GuzzleHttp\Client to make concurrent requests.

[!NOTE]\ I love GuzzleHttp\Pool, but I would to build a wrapper to make it easier to use and Laravel Http\Pool is cool but not flexible enough for me. So HttpPool allow you to send an array or a Collection of requests and get a Collection<mixed, HttpPoolResponse> of with all GuzzleHttp features and more.

Built to be more flexible that Laravel Http Pool, if Laravel Pool is perfect for you, keep using it.

Features

Installation

You can install the package via composer:

Usage

Input

When you want to use HttpPool, you have to pass an input, it could be: a simple array, an associative array, a Laravel Collection or an array of objects.

With simple array

Associative array

[!WARNING]\ Identifier and URL have to not be nested.

Laravel models

Take a Laravel model collection and send requests with HttpPool. Here Book is a Laravel model, we assume that Book has an id attribute and a google_book_api attribute.

Array of objects

Here we take an array of objects, we assume that each object has an uuid attribute and an url attribute. You can just define getters like getUuid() and getUrl() or you can use public attributes, it's up to you.

[!WARNING]\ If attributes are private or protected, you have to define getters with logic names: getUuid() and getUrl(). You can use uuid() and url() too as getters. But here, if you create a getter getBookUuid(), it will not work.

Execution

To execute pool, you can use execute() method.

execute() method returns a HttpPoolFullfilled object. You can get pool with getPool() method.

In HttpPoolFullfilled object, you can get responses and more features. All methods getResponses(),getFullfilled(), getRejected() are Illuminate\Support\Collection of HttpPoolResponse.

Errors

To handle errors, you can just use HttpPool::make() method and errors will throw exceptions. But if you want to prevent errors, you can use throwErrors param.

All errors can be found in getErrors() method, after pool execution.

Response

After pool execution, you can get responses with getResponses() method. It returns a Collection of HttpPoolResponse.

[!NOTE]\ The first item of getResponses could not be the first request you sent. It depends of the response time of each request. But you can retrieve the original request with getMetadata()->getRequest() method, the best way to find parent is to define an ID, that you could retrieve it with getId() method.

Metadata

HttpPoolResponse has a HttpPoolResponseMetadata attribute, it contains some useful data. Here $first is a HttpPoolResponse.

Body

HttpPoolResponseBody is a wrapper of GuzzleHttp\Psr7\Stream with some useful methods. Here $first is a HttpPoolResponse.

Advanced

You can use some advanced options to customize your pool.

Use URL as identifier to replace ID.

Enable console output.

Memory peak

Handle memory peak is optional, but if you have a lot of requests, you can use allowMemoryPeak to avoid memory peak. New memory peak will be set inside execute() method.

Memory peak is set to 2G by default, you can change it with second param.

Testing

Changelog

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

Credits

License

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


All versions of php-http-pool with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
guzzlehttp/guzzle Version ^7.7
illuminate/support Version ^10 || ^11.0
symfony/console Version ^6 || ^7
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 kiwilan/php-http-pool contains the following files

Loading the files please wait ....