Laravel: Making middleware understandable

this.quickly:can,become,unintelligible

Photo by Jida Li on Unsplash

The case of large middleware declarations

The point of middleware is how simple they’re to declare. Most of the time you’re a string away, but you may have a package that inevitability demands you to set a large set of parameters.

Two ways to declare middleware: with the alias, or using the class name directly.
  1. set parameters in any order.
  • It’s no longer obligatory to register an alias into the HTTP Kernel.
  • It’s no longer required to push a middleware class names and concatenate parameters manually.
  • You can set values in any order.
  • You can set a defaults values in the helper instead of the middleware itself.

Graphic Designer graduate. Full Stack Web Developer. Retired Tech & Gaming Editor.