Support the ongoing development of Laravel.io →
Configuration Security

Hi All!

Lets say that i need to have all the users entered data encrypted in my db and i am doing it like this:

Crypt::encrypt($request['content'])

Does this mean that i have to be absolutely sure that i don't loose my app_key which is in my .env file?

Last updated 3 years ago.
0
Solution

Yes, to decrypt you need the same APP_KEY you used to encrypt.

You can just test it in artisan tinker console. Start console, encrypt something, save in a file, exit, change app key in .env file, restart console, load a file, try to decrypt.

0

Sign in to participate in this thread!

Eventy

Your banner here too?

e4rthdog e4rthdog Joined 15 Apr 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.