New

Just launched: Vueblocks, a brand-new search engine for Vue packages! Explore Vueblocks →

x/laravel-connection-pool

Connection pooling for illuminate/database
6 30
Install
composer require x/laravel-connection-pool
Latest Version:v0.0.1
PHP:^7.4
Laravel:6
Last Updated:Feb 1, 2023
Links: GitHub  ·  Packagist
Maintainer: mink

Laravel Connection Pool

Build Status

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();

Related Packages

kdabrow/seeder-once

Run your laravel seeders only once

198,056 20
forrest79/phpgsql

PostgreSQL library for PHP with fluent interface for SQL query writing.

9,652 15
asseco-voice/laravel-blueprint-audit

Laravel support for additional blueprint methods

7,729 0
spresnac/laravel-artisan-database-helper

Some useful helper to handle database backup & restores

3,736

Version History

Version Released PHP Laravel License
v0.0.1 ^7.4 ^6.6