troodi / laravel-connection-pool
There is no license information available for the latest version (dev-master) of this package.
Connection pooling for illuminate/database
dev-master
2022-09-05 11:40 UTC
Requires
- php: ^8.0
- illuminate/database: ^6.0|^7.0|^8.0
Requires (Dev)
- ext-bcmath: *
- ext-pdo: *
- orchestra/testbench: ^5.1|^6.2
- phpunit/phpunit: ^9.1
- swoole/ide-helper: @dev
- vimeo/psalm: ^3.16
This package is auto-updated.
Last update: 2024-05-05 15:32:24 UTC
README
Laravel Connection Pool allows you to take advantage of Laravel's query builder and Eloquent ORM in an asynchronous environment. Perform concurrent database operations through a familiar fluent interface without having to worry about locking contention, let alone what connection you are using.
Note: This package is a work in progress and is unsafe for use in production.
Requirements
- PHP 7.4+ (CLI only)
- Swoole PHP extension
Installation
composer require x/laravel-connection-pool
Usage
// concurrent operations go(fn () => Server::where('terminated_at', '<=', now()->subMinutes(5))->delete()); go(function () { Session::where('active', true)->get()->each(function ($session) { // }); }); Swoole\Event::wait();
// run 100 SLEEP(1) queries at once, takes ~1s for ($i = 0; $i < 100; $i++) { go(fn () => DB::statement('SELECT SLEEP(1)')); } Swoole\Event::wait();