Tips tagged with "Laravel"

Browse all tips tagged with Laravel.
shape
shape
shape
shape
shape
shape
shape
shape

Database Hard

Cache Stampede Prevention: Locks, XFetch, Stale-While-Revalidate and Laravel Cache::flexible

Why a hot key expiring can melt your database, and four fixes: Cache::lock with double-check, XFetch early expiration, Cache::flexible, and TTL jitter.

Laravel 13 PHP 8.4 Redis 7.4
Diagram Try the challenge
11 min Read tip
Laravel Hard

Transactional Outbox in Laravel: Never Lose an Event Between Your Database and the Broker

Writing to the database and a broker in one request loses or invents events on crashes. Fix the dual-write problem with an outbox table, relay and idempotent consumers.

Laravel 13 PHP 8.4 Mysql 8.4
Diagram Try the challenge
9 min Read tip
Security Medium

CORS Explained: Same-Origin Policy, Preflight, Credentials and Laravel config/cors.php

CORS errors tempt you to reflect any Origin and move on. Learn what the browser checks, when preflight happens, how credentials change the rules, and safe config.

Laravel 13 PHP 8.4 Node.js 22
Diagram Try the challenge
10 min Read tip
PHP Medium

PHP Generators for Memory-Efficient Processing: yield, yield from, send() and LazyCollection

Stream a 2 GB CSV in 2 MB of RAM. How PHP generators work: yield with keys, yield from, send(), Laravel LazyCollection, cursor vs lazyById.

PHP 8.4 Laravel 13
Diagram Try the challenge
11 min Read tip
Database Medium

Optimistic Locking With a Version Column: Fix Lost Updates in Laravel (vs lockForUpdate)

Two users save the same record and one change silently disappears. Fix lost updates with a version column, 409 responses and retries, and know when lockForUpdate fits better.

Laravel 13 PHP 8.4 Mysql 8.4
Diagram Try the challenge
10 min Read tip
DevOps Medium

Health Checks Done Right: Liveness vs Readiness vs Startup Probes

A database query in a liveness probe can turn a 40-second failover into a full outage. Learn what each probe should check, with Kubernetes, Docker and Laravel /up.

Kubernetes 1.33 Laravel 13 PHP 8.4
Diagram Try the challenge
9 min Read tip
Laravel Medium

Laravel Pipelines: Turn a 340-Line Checkout Controller into Small, Testable Steps

Use the Laravel Pipeline facade to split checkout flows and query filters into pipe classes you can reorder, reuse and unit test, with the pitfalls to avoid.

Laravel 13 PHP 8.4
Diagram Try the challenge
9 min Read tip
Security Medium

Verifying Webhook Signatures with HMAC: Raw Body, Timing-Safe Compare and Replay Protection

A webhook URL is a public endpoint that changes your data. Verify HMAC signatures on the raw body, compare in constant time and block replays with timestamps.

Laravel 13 PHP 8.4 Node.js 22
Diagram Try the challenge
10 min Read tip
Database Hard

Transaction Isolation Levels: Dirty, Non-Repeatable and Phantom Reads in MySQL and PostgreSQL

Why DB::transaction() did not stop your oversold stock: what each isolation level guarantees in MySQL vs PostgreSQL and how to pick one in Laravel.

Laravel 13 PHP 8.4 Mysql 8.4
Diagram Try the challenge
11 min Read tip
PHP Medium

PHP Enums Beyond the Basics: Backed Enums, Methods, tryFrom and Eloquent Casts

One 'canceled' vs 'cancelled' typo can strand orders for days. Use backed enums with methods, interfaces, tryFrom and Eloquent casts to kill magic strings.

PHP 8.4 Laravel 13 Python 3.12
Diagram Try the challenge
11 min Read tip
DevOps Hard

Zero-Downtime Database Migrations with Expand/Contract: Rename Columns Without Breaking Deploys

Renaming a column mid-deploy breaks old servers and queue workers. Use expand/contract, batched backfills and the right deploy order to change schemas safely.

Laravel 13 PHP 8.4 Mysql 8.4
Diagram Try the challenge
12 min Read tip
Database Medium

Offset vs Cursor Pagination: Why Page 4,000 Is Slow and How Keyset Queries Fix It

OFFSET makes deep pages slow and shuffles rows when data changes. Learn keyset queries, composite cursors, Laravel cursorPaginate and cursor-based API design.

Laravel 13 PHP 8.4 Mysql 8.4
Diagram Try the challenge
11 min Read tip
Security Medium

Password Hashing Done Right: bcrypt vs Argon2id, Cost Tuning and Rehash on Login

MD5 and SHA-256 crack in hours once a dump leaks. Pick bcrypt or Argon2id, tune the cost on real hardware and upgrade old hashes on login in PHP and Laravel.

PHP 8.4 Laravel 13 Python 3.13
Diagram Try the challenge
11 min Read tip
Laravel Medium

Laravel Job Batching vs Chains: Progress, Failures, allowFailures and then/catch/finally

Bus::chain runs jobs in order and stops at the first failure; Bus::batch runs them in parallel with progress and callbacks. Learn exactly when then, catch and finally fire.

Laravel 13 PHP 8.4
Diagram Try the challenge
10 min Read tip
Laravel Medium

Laravel Query Optimization with Eager Loading

Learn how to optimize database queries in Laravel by using eager loading to prevent N+1 query problems.

Laravel 11.x PHP 8.2+
Diagram
2 min Read tip