Level 3
I found a solution!
$this->app->afterResolving(EncryptCookies::class, function ($middleware) {
$middleware->disableFor($cookieName);
});
to be added in the boot() method in the service provider of the package.
1 like
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hi everyone, I am developing a package in Laravel 11, where I have to set up a cookie, that I need to read via GTM, so I need to be not encrypted. I know I can disable encryption in the middleware. But would be possible to add it via the package service provider? My objective is just to remove this additional step.
I am setting this cookie via livewire. Therefore I cannot disable cookie encryption middleware from the route. Any additional idea is welcome!
use Illuminate\Cookie\Middleware\EncryptCookies;
EncryptCookies::except('cookie_name');
Please or to participate in this conversation.