master

laravel/framework

Last updated at: 29/12/2023 09:25

Crypt.php

TLDR

This file is a part of the Illuminate\Support\Facades namespace. It contains a class named Crypt, which is a facade for the Encrypter class. The Crypt class provides static methods for encrypting and decrypting data using various ciphers.

Methods

supported

This method checks if a given cipher is supported for encryption.

generateKey

This method generates a random encryption key for a given cipher.

encrypt

This method encrypts a given value, optionally serializing it before encryption.

encryptString

This method encrypts a string value.

decrypt

This method decrypts a given payload, optionally unserializing it after decryption.

decryptString

This method decrypts a payload containing a string value.

getKey

This method returns the encryption key used by the Encrypter.

Classes

None

<?php

namespace Illuminate\Support\Facades;

/**
 * @method static bool supported(string $key, string $cipher)
 * @method static string generateKey(string $cipher)
 * @method static string encrypt(mixed $value, bool $serialize = true)
 * @method static string encryptString(string $value)
 * @method static mixed decrypt(string $payload, bool $unserialize = true)
 * @method static string decryptString(string $payload)
 * @method static string getKey()
 *
 * @see \Illuminate\Encryption\Encrypter
 */
class Crypt extends Facade
{
    /**
     * Get the registered name of the component.
     *
     * @return string
     */
    protected static function getFacadeAccessor()
    {
        return 'encrypter';
    }
}