Cursor Pagination in Laravel APIs: Why Offset Breaks on Large Tables
Laravel cursor pagination keeps API list pages fast and complete on large tables, where offset pagination slows down and skips or repeats rows.
Read articleNotes, lessons and practical insights from building software, engineering backend systems and working with modern infrastructure.
Practical knowledge, technical discoveries and lessons collected along the way.
Laravel cursor pagination keeps API list pages fast and complete on large tables, where offset pagination slows down and skips or repeats rows.
Read articleRun a Laravel queue worker as a systemd service on Ubuntu so it starts on boot, restarts on failure, and survives deploys. Full unit file and setup.
Slow jobs should never block fast ones. Learn how Laravel queue priorities with multiple queues keep password resets and notifications moving.
Stop re-sending JSON clients already have. Use ETags and If-None-Match in Laravel to return 304 Not Modified and cut bandwidth.
PHP mail() returns true but the email never arrives on shared hosting. Here is why it fails silently and how authenticated SMTP fixes it.
Laravel updateOrInsert fails with Array to string conversion when you pass an array value and the row does not exist yet. Here is why, and the fix.
Verify file uploads with SHA-256 checksums in Laravel: hash on the client, hash again on the server, and reject truncated uploads before they are stored.
Trace a Laravel request through the web process and the queue with structured JSON logs and one correlation ID per request.
Build a Laravel health check endpoint that probes the database, Redis, and disk space and returns a real 503 when any of them fail.
Scope every query by organization in a multi-tenant Laravel app with a global scope and trait, so tenant data stays private and cross-tenant leaks cannot happen.
Learn how to verify webhook signatures with HMAC in Laravel: sign the raw body, compare with hash_equals, and reject forged requests with a 401.
Make your Laravel queue jobs idempotent so a retry never charges twice or sends two emails. Practical patterns: locks, claim rows, and unique keys.
Laravel migrations fail on Postgres when the search_path schema does not exist yet. Here is the error, why it happens, and how to fix it.
A cron job that runs longer than its interval starts a second copy of itself. Here is how file locking with flock stops overlapping cron runs on shared hosting.
Structuring a Laravel API so it stays readable: thin controllers, Form Requests for validation, services for business logic, and Resources for responses.
Before you open the server logs, check DNS and the TLS certificate. Two one-minute checks that catch the silent causes of a site appearing dead.
Composer autoload works locally but fails on Linux with Class not found? Usually it is a case-sensitive PSR-4 file name. Here is how to find and fix it.
Moving a Laravel app from Apache to nginx? Learn what breaks: .htaccess, rewrites, PHP-FPM, uploads, and permissions, with working config.
Webhook delivery retries with exponential backoff: why fixed intervals fail, how to schedule retries, add jitter, and make redelivery safe.
Cache busting CSS and JS on shared hosting without a build step: version assets with filemtime and set far-future cache headers.
Set up a GitHub Actions CI pipeline for a PHP project: workflow file, tests with a real database, secrets, and caching.
Set Horizon wait thresholds, route alerts to Slack or email, and keep the daemon healthy so a stalled queue pages you before a user complains.
A repeatable method for debugging a slow API endpoint: measure, check the database, time the parts, and confirm the fix.
Why PostgreSQL too many clients hits small RDS instances, how to confirm pool exhaustion, and how to fix it with a pooler and worker caps.
How to add API rate limiting in Laravel with Redis: throttle middleware, named limiters, and Redis throttling for queue workers.
PHP "Allowed memory size exhausted" is a symptom, not the diagnosis. Learn to find the leak, fix the code, and know when raising the limit is the honest fix.
Deploy to a single EC2 instance with zero downtime using release directories and an atomic symlink flip, plus backward-compatible migrations and worker restarts.
A database index can make queries slower in PostgreSQL. Learn the four causes: stale stats, low selectivity, write cost, and bloat, and how to fix each one.
Laravel Sanctum tokens never expire by default. Learn the expiry pitfalls: retroactive lifetimes, cookie vs token clocks, revocation, and pruning.
A practical Docker Compose setup for local Laravel development: PHP, database, Redis, and queue workers running the same way on every machine.
nginx 502 bad gateway from PHP-FPM means PHP never answered. Ordered checklist: error log, FPM status, socket path, pool saturation, timeouts, permissions.
A cache stampede hits when a Redis key expires under load and hundreds of requests rebuild it at once. Here is a Laravel lock pattern that stops it.
Queue jobs fail where nobody is watching: the worker process. Five silent failure modes I check first, and the artisan commands that surface them.
Learn to read PostgreSQL EXPLAIN ANALYZE output: find the slow plan node, compare row estimates, fix unused indexes, and speed up queries.
What deploying this portfolio to HosterPK shared hosting taught me about LiteSpeed file permissions, .htaccess and clean URLs without a framework.
How this site serves /projects and /contact with Apache rewrite rules on LiteSpeed — canonical redirects, genuine 404s and no redirect loops.
File Manager uploads containing script tags were rejected with HTTP 406 by the host WAF. Here is what worked instead.
Domain-level verification via DNS TXT, submitting a sitemap with a bare path, and requesting indexing — the exact steps that worked for this site.
The repeatable checklist I run for every PHP deploy: backups, permissions, rewrite rules, cache-busting, verification and rollback.
Blast radius first, recent changes second, logs over assumptions: the method I use when production breaks.