Skip to content
OpenCloseEsc

Blog(6)

Notes on Laravel, PHP, React and the web, written from real projects.

RSS feed
New
  • laravel
  • php
  • architecture

Laravel structure for a scalable monolith

Most apps I build are monoliths, and they hold up fine. The trick is not microservices, it is keeping one Laravel app organized: thin controllers, one class per job, slow work in queues, and an eye on the database.
Published on
5 min read
New
  • laravel
  • php
  • enums

How I use string enums in Laravel

A typo between 'complete' and 'completed' lived in production for two weeks. Since then every status is a string enum: cast on the model, validated with Rule::enum, with its labels, colors and rules inside it.
Published on
5 min read
New
  • laravel
  • php
  • api

Rate limiting in Laravel: we built it ourselves, then Laravel shipped it

We needed limits per minute, per hour and per day, so we wrote a middleware with three cache counters. It had a race, wrong headers and a day that reset at 3:47 PM. Laravel's RateLimiter does all of it in three lines.
Published on
5 min read
New
  • laravel
  • php
  • api

I wrote a rate limiter Laravel already had

A 190-line class with three windows, tests and hand-built headers, for an app on Laravel 8.83. Limit::perHour and perDay had been in vendor/ since 2020, and a named limiter can return all three at once.
Published on
4 min read
New
  • laravel
  • php
  • caching

Stopping a cache stampede in Laravel

What happens when a hot cache key expires on a busy site, and two small fixes: an atomic lock so one request rebuilds, and serving stale data so nobody waits.
Published on
6 min read
New
  • laravel
  • php
  • concurrency

Preventing race conditions with atomic locks in Laravel

Two requests, one seat, two owners: how the check-then-write gap bites, and when to reach for Cache::lock versus lockForUpdate.
Published on
7 min read