x/laravel-connection-pool is a Laravel package for connection pooling for illuminate/database.
It currently has 31 GitHub stars and 5 downloads on Packagist (latest version v0.0.1).
Install it with composer require x/laravel-connection-pool.
Discover more Laravel packages by x
or browse all Laravel packages to compare alternatives.
Last updated
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.
composer require x/laravel-connection-pool
// 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();