Skip to content
← Projects / Laravel Spool
Active MIT

Laravel Spool

Batch and defer expensive database writes in Laravel - no Redis, no queues, no background workers required. Works on shared hosting. Drop 1,000 individual DB inserts down to a single batch operation.

Laravel PHP Queue Systems File Processing Package Development Filesystem Architecture
1000 → 1
Inserts per flush
File + Redis
Buffer drivers
MIT
License
Active
Status

01 / Problem

What it solves

Every event in a Laravel app, a page view, an API hit, a user action, typically writes to the database once, immediately. Under normal traffic that is fine. Under load it becomes a bottleneck: lock contention, slow response times, and a database that cannot keep up with a stream of individual inserts hitting it on every request.

The standard fix requires real infrastructure. Laravel queues, Redis, Horizon, Supervisor. On managed servers that is achievable but adds operational overhead. On shared hosting, those options are not available at all. Either way, you are adding significant complexity to solve what is fundamentally a write frequency problem.

Laravel Spool captures high-frequency writes to a fast local buffer first, then flushes them as a single batch on a schedule you control. One thousand individual inserts become one batch insert. The write cost moves off your HTTP response cycle entirely. The filesystem driver works anywhere PHP runs, with Redis Streams available as an optional upgrade when your infrastructure supports it.

02 / Features

What you get

  • Filesystem buffering that works on any host without Redis, extensions, or extra services
  • Sharded writes across multiple files to reduce lock contention under concurrent load
  • Atomic shard processing via file rename, preventing duplicate processing across concurrent flush jobs
  • Three-stage shard lifecycle (active, processing, completed) for visibility and auditability
  • Multiple named buckets for separate buffers per data type
  • Redis Streams driver as an optional upgrade path when infrastructure supports it
  • Health check command to verify buffer directories and config before deploying
  • TTL-based shard cleanup with no manual disk management required
  • Works on shared hosting with only a standard Laravel scheduler cron entry

03 / Install

Up and running in minutes

One command to install. No external services, no extra infrastructure.

composer require alihaiderx/laravel-spool

Work with me

Using this in production?

Happy to help with setup, customization, or integration questions. If you need backend consulting beyond the tool, get in touch.

Get in touch See how I work

More projects

Keep exploring

Enterprise healthcare compliance platform for regulated care providers, covering clinician assessments, occupational health workflows, workforce onboarding, training management, and automated compliance tracking.

Laravel PHP MySQL Livewire CI/CD

Government-approved UK compliance platform for identity verification and background checks, designed for strict regulatory and security requirements including ISO and DIATF compliance. Built with real-time tracking, secure workflows, and audit-ready architecture for regulated industries.

Laravel PHP MySQL CI/CD