Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

GYatesIII's avatar

Reading Laravel Encrypted Cookies in Lumen

We recently split off a part of our application into a micro service run by Lumen. But we have an issue, it cannot read the cookies set by the previous Laravel application.

The Laravel app that set the cookies is 4.2 and uses the MCRYPT_RIJNDAEL_256 cipher. I've tried using the same encryption key used in the Laravel app in Lumen and the same cipher, and it just removes the cookie.

I would be happy to write my own middleware that can decrypt the cookie using the old enc key and cipher, and then rewrites them using Lumen's more modern cipher and encryption strategy if that's appropriate. Or just configuring Lumen to handle it automatically.

I have enabled Illuminate\Cookie\Middleware\EncryptCookies

Lumen will be completely responsible for reading and writing these cookies going forward, but I need backwards support for the Laravel cookies already in existence.

0 likes
0 replies

Please or to participate in this conversation.