Laravel

Middleware

Middleware runs on every request, so it can cause performance issues.

This might be a scary subject for most, but middleware gives you a lot of flexibility when you need functionality that has to run on every request, or on a group of requests.

Do not create middleware if you only need the functionality for a single request and you are unlikely to ever extend it to more requests.

This is up to your discretion, but use it wisely — with great power comes great responsibility.

Copyright © 2026