Encryption

    Before using Laravel's encrypter, you should set the option of your config/app.php configuration file to a 32 character, random string. If this value is not properly set, all values encrypted by Laravel will be insecure.

    Basic Usage

    Encrypting A Value

    You may encrypt a value using the Crypt facade. All encrypted values are encrypted using OpenSSL and the AES-256-CBC cipher. Furthermore, all encrypted values are signed with a message authentication code (MAC) to detect any modifications to the encrypted string.

    Decrypting A Value

    1. try {
    2. $decrypted = Crypt::decrypt($encryptedValue);
    3. } catch (DecryptException $e) {
    4. }