Lumen provides facilities for strong AES encryption via the Mcrypt PHP extension.
$encrypted = Crypt::encrypt('secret');
Note: Be sure to set a 32 character random string in the
APP_KEY
option of the.env
file. Otherwise, encrypted values will not be secure.
$decrypted = Crypt::decrypt($encryptedValue);
You may also set the cipher and mode used by the encrypter:
Crypt::setMode('ctr');
Crypt::setCipher($cipher);