Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Pool Laravel Package

hyperf/pool

hyperf/pool provides a coroutine-safe connection pool for Hyperf applications, managing reusable connections with configurable limits, idle timeouts, and wait strategies. It helps reduce connection overhead and improve performance in high-concurrency PHP services.

Deep Wiki
Context7

At a glance

Frequently asked questions about Pool
What is hyperf/pool used for?
hyperf/pool provides a coroutine-safe connection pool for Hyperf applications running on Swoole. It lets you reuse expensive resources such as database or Redis connections across concurrent coroutines instead of creating a new connection for every request. The package handles borrowing and returning connections automatically and integrates with the Hyperf DI container.
How do I install hyperf/pool?
Install it with Composer using composer require hyperf/pool. You usually do not need to register a service provider manually because Hyperf's DI and component discovery handle integration. After installation, configure your pool and connection classes in Hyperf's config files and resolve the pool from the container.
Is hyperf/pool compatible with Laravel?
No, hyperf/pool is built for the Hyperf framework and relies on Swoole coroutines, hyperf/di, and hyperf/channel. It is not a Laravel package and will not work as a drop-in connection pool in a standard Laravel application. Laravel developers would need a different pooling solution unless they are running Hyperf alongside their stack.
How do I configure pool limits, idle timeouts, and wait strategies?
Pool behavior is configured through the options passed to your pool implementation, such as maximum connections, minimum connections, idle timeout, and how long a coroutine waits when the pool is exhausted. Because hyperf/pool exposes a Pool interface, your concrete pool class defines which options it supports and how they are applied. Check the specific pool implementation you use for exact configuration keys.
How does hyperf/pool keep connection pooling coroutine-safe?
The package uses hyperf/channel, a coroutine-safe channel abstraction, to store and hand out connections. When a coroutine borrows a connection, the pool removes it from the channel; when the coroutine releases it, the connection goes back into the channel for reuse. This avoids race conditions and blocking behavior under concurrent load.
Can I build a custom connection pool with hyperf/pool?
Yes. hyperf/pool provides a Pool interface and a ConnectionInterface contract that you can implement for your own resources. You define how connections are created, validated, borrowed, and returned, while the package handles the coroutine-safe storage and lifecycle plumbing. This makes it suitable for databases, Redis, HTTP clients, or other expensive resources.
What PHP and Hyperf versions does hyperf/pool support?
The package is maintained as part of the Hyperf ecosystem and typically follows the PHP and Hyperf version requirements of the framework release you are using. Check the composer.json constraints for the exact PHP and hyperf/* versions supported by the release you install. In general, you should use a hyperf/pool version that matches your Hyperf minor version.
How do I test code that uses hyperf/pool?
Because pooled resources are resolved through the DI container, you can swap the pool or connection implementation with a test double in your container for unit tests. For integration tests, run them inside a Swoole coroutine context so that channel operations behave as they do in production. Test both normal borrowing and pool exhaustion scenarios, including wait and timeout behavior.
What are the alternatives to hyperf/pool?
Within Hyperf, hyperf/pool is the standard pooling abstraction and is often used indirectly through hyperf/db and hyperf/redis connection pools. Outside Hyperf, you would look at framework-specific pools or generic Swoole connection pool libraries. If you are on Laravel, Laravel's database connection handling and tools like Octane offer different pooling models.
Is hyperf/pool production-ready and how is it maintained?
hyperf/pool is a core Hyperf component used by other official packages such as database and Redis clients, so it is intended for production use in Hyperf services. Maintenance follows the Hyperf release cycle, with fixes and compatibility updates landing alongside framework releases. As with any dependency, pin a stable version and review changelogs before upgrading in production.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
vento/laravel-airbrake
wfeller/laravel-batch
maco-studios/mage-os-installer
busarm/armie
siberfx/laravel-logger
kfteam1991/dcat-admin
dashed/dashed-laposta
dashed/dashed-ecommerce-montaportal
dashed/dashed-ecommerce-etsy
neohq/string-blade-compiler
log1x/acf-composer
cgv/localized-resource
noith/settings
kda/laravel-package
kda/filament-dynamic-navigation
bypersoft/signbox
pairus/product-data
fayne/laravel-filament-cms-core
nodisrupt/laravel-agent
sierratecnologia/media-manager