Laravel

Posts About Laravel

Laravel is a powerful PHP framework that simplifies web development with its elegant syntax and comprehensive toolkit. It streamlines tasks like routing, authentication, and caching, making it ideal for both simple and complex applications.

The Database Queue Driver Is Production Ready

For years the advice was clear: never run the database queue driver in production, use Redis. That advice is out of date. Modern databases fix...

3 mins read

Laravel Database Connection and Configuration

Laravel keeps database setup simple. You rarely touch raw connection code. Instead you fill in a few values, and Eloquent and the query builde...

2 mins read

List All Your Routes in Laravel

Sometimes you just need to see every route in your app, with its method, URI and the controller action behind it. Years ago you might have wri...

2 mins read

Ensuring Horizon Terminates Gracefully

One of Horizon's nicest features is graceful shutdown: when told to stop, it waits for any in-flight jobs to finish before terminating its wor...

3 mins read

Creating a One to One Relationship in Laravel

A one to one relationship means one row in a table matches exactly one row in another table. You do not reach for it often, because if two tab...

3 mins read

Laravel Database Per Tenant: On the Fly Connections for a Multi Tenant App

Giving every tenant their own database is one of those things that sounds hard until you see how Laravel actually wires up a connection. Once...

Introduction to Redis with Laravel

Redis is a storage server that keeps your data in memory, which makes reading and writing extremely fast. It can also save that data to disk n...

5 mins read

Force HTTPS and a Canonical Domain in Laravel

For SEO and consistency you want every visitor on one canonical address: HTTPS, and one of www or the bare domain, not both. Serving the same...

2 mins read

Accessing Route Parameters in Laravel Middleware

Middleware wraps a request: it runs code before or after your controller. Sometimes that code needs to know a value from the URL, like the {us...

2 mins read

How Laravel Prepares a Job for the Queue

When you dispatch a job, it does not run there and then. It gets turned into a small record and stored, in MySQL, Redis, or SQS, until a worke...

4 mins read

Speeding Up Laravel on a Production Server

A fresh Laravel deploy can feel sluggish, and the fix is usually not your code. It is that production is still running with development settin...

3 mins read

Persisting Redis Data on Disk: Snapshots vs AOF

Redis keeps your data in memory, which is exactly why it is fast and also why a crash can wipe everything in an instant. For some uses that is...

4 mins read

Dispatching Unique Jobs to Laravel Queues

Here is a common need. Every time a product is updated you dispatch a job to rebuild the search index. If ten products are edited in a minute,...

3 mins read

Database Transactions in Laravel, and the afterCommit Trap

A database transaction groups several queries into one all or nothing unit. Either every query succeeds and the changes stick, or one of them...

5 mins read

Prevent Your Queued Jobs From Running Twice

You notice the same job ran twice. The email went out twice, the charge happened twice, and you are sure you dispatched it once. Before suspec...

3 mins read

To Use Laravel Vapor or Not?

Vapor is great, but it is not for every project. Rather than hype it, here are the objections people actually raise, answered honestly, so you...

3 mins read

Rationing Your Laravel Queue Workers' Memory and CPU

If your workers share a server with your web app, or run on a small box, they can quietly eat the resources your site needs. The goal is to le...

3 mins read

Preventing Scheduled Tasks From Overlapping in Laravel

A scheduled task can take longer than the gap between its runs. Picture a report that runs every minute. Early on it finishes in seconds, but...

3 mins read

Avoiding Memory Leaks in Laravel Queue Workers

People love to argue about whether PHP is suited to long running processes. In practice, Laravel workers crunch enormous numbers of jobs relia...

3 mins read

How Laravel Horizon Works

Laravel Horizon is a queue manager for Redis queues. It gives you a single config file to describe how your jobs should be processed, a dashbo...

4 mins read