Download the PHP package utopia-php/pools without Composer
On this page you can find all versions of the php package utopia-php/pools. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download utopia-php/pools
More information about utopia-php/pools
Files in utopia-php/pools
Package pools
Short Description A simple library to manage connection pools
License MIT
Informations about the package pools
Utopia Pools
Utopia pools library is simple and lite library for managing long living connection pools. This library is aiming to be as simple and easy to learn and use. This library is maintained by the Appwrite team.
Although this library is part of the Utopia Framework project it is dependency free, and can be used as standalone with any other PHP project or framework.
Concepts
- Pool - A list of long living connections. You can pop connections out and use them and push them back to the pool for reuse.
- Connection - An object that holds a long living database or other external connection in a form of a resource. PDO object or a Redis client are examples of resources that can be used inside a connection.
- Group - A group of multiple pools.
Getting Started
Install using composer:
Examples
Reconnect and Retry
Both reconnect and retry logic is used in pop()
method to handle problematic scenarios. Both allow you to configure 2 properties:
attempts
- How many times library will retry when problem occurssleep
- How long will library wait for before next retry attempt
Reconnect settings are used when your connection initialization callback throws an exception. This can occur for example, when a handshake with SQL server fails.
Retry settings are used when pool of connection is empty and there is no more connections to pop. This can occur for example, when your server supports more concurrent actions than your pool.
System Requirements
Utopia Framework requires PHP 8.0 or later. We recommend using the latest PHP version whenever possible.
Tests
To run all unit tests, use the following Docker command:
To run static code analysis, use the following Psalm command:
Copyright and license
The MIT License (MIT) http://www.opensource.org/licenses/mit-license.php