laravel/legacy-encrypter
Drop-in Laravel encrypter compatible with legacy apps. Encrypt/decrypt data using older key formats and cipher settings so you can read existing payloads and migrate safely. Useful for upgrades where stored encrypted values must remain accessible.
legacy-encrypter package is designed to replicate the deprecated mcrypt-based encryption behavior in Laravel (pre-Laravel 8.x). It is a drop-in replacement for the removed mcrypt driver, ensuring backward compatibility for legacy systems still using this encryption method.mcrypt to Laravel’s modern encryption stack (e.g., OpenSSL).mcrypt was previously used, without requiring a full re-encryption effort.openssl, defuse/php-encryption) should be preferred.mcrypt is obsolete (removed in PHP 7.2+), and this package is a temporary bridge. Long-term reliance introduces security and maintenance risks.mcrypt is slower and less secure than modern alternatives (e.g., AES-256 via OpenSSL).config/app.php encryption driver from 'mcrypt' to 'legacy-encrypter' and install the package via Composer.Illuminate\Encryption\Encrypter interface, so existing encryption/decryption logic (e.g., Crypt::encrypt()) remains unchanged.mcrypt-encrypted payload.mcrypt uses outdated algorithms (e.g., rijndael-128, rijndael-256) vulnerable to attacks like Sweet32 or BEAST.mcrypt implementations may use insecure key stretching (e.g., no PBKDF2).mcrypt lacks HMAC for tamper detection.openssl or defuse/php-encryption.Illuminate/Encryption facade (Crypt).mcrypt driver.mcrypt itself is still deprecated).mcrypt-encrypted data exists.mcrypt.composer require laravel/legacy-encrypter
Update config/app.php:
'encryption' => [
'driver' => 'legacy-encrypter',
// ... other config (e.g., key, cipher)
]
openssl.legacy-encrypter and re-encrypted.// Decrypt legacy data
$legacyData = Crypt::decrypt($mcryptPayload);
// Re-encrypt with OpenSSL
$newData = Crypt::encrypt($legacyData, 'openssl');
openssl.mcrypt compatibility entirely.rijndael-128, rijndael-256, and rijndael-192 (default: rijndael-256).mcrypt)..env (e.g., APP_KEY=base64:...).openssl → Store both.legacy-encrypter; enforce openssl for all encryption.mcrypt PHP extension).php-mcrypt is not installed (this package is a pure-PHP polyfill).try {
$decrypted
How can I help you explore Laravel packages today?