Decrypting a Value


You want to decrypt a string.

You've encrypted a string and are ready to decrypt and use it.


Use Crypt::decrypt().

$value = Crypt::decrypt($encrypted);


You must decrypt the value with the same key used to encrypt it.

Laravel's encryption routines use Config::get('app.key') for encryption. This happens internally. Since this value is different for every Laravel application then the application that encrypts a value must also decrypt the value.

Or ...

The application must call Crypt::setKey() prior to decrypting to match the key to the value used for encrypting. See Setting the Encryption Key.

comments powered by Disqus