Dark Web Talk

how to use laravel middleware

Started by dddread · Jan 27, 2026

#3853
very simple question, how to use middleware

1. for me middleware dont work like regular but work in bootstrap/app.php

2. how to in app.php add 2 lines of code 1. line that will intercept first line of code when something is loading on server and 2. line that will intercept last line of code very simple but so complicated

3. how to besides regular encription make another encripton for cookies
#3854
↳ Replying to @dddread
In Laravel 11, you no longer add middleware to arrays in a Kernel file. You use the withMiddleware callback in bootstrap/app.php.
#3855
↳ Replying to @zdayofficial
txt, can u give me all(if small number) or some basic one for bootstrap/app.php i had found this important one

$middleware->alias([

'test.alias' => TestMiddleware::class,

]);

h t t p s ://medium.com/@aiman.asfia/understanding-middleware-in-laravel-12-a-comprehensive-guide-76dc0eb4de0a

or some very usefull one??
#3856
↳ Replying to @dddread
and another important question is it possible to make cookies decriptor so basicly browser and user cant see real cookies names and values, and server can succesfully encript/decript it and use it like normaln, but browser dont see it??