laminas/laminas-crypt
Laminas Crypt offers cryptographic tools for PHP applications: symmetric encryption, block ciphers, secure password hashing, key derivation, and public-key/hybrid encryption helpers. It provides a consistent, framework-agnostic API within the Laminas ecosystem.
Architecture fit
laminas/laminas-crypt is a framework-agnostic component from the Laminas (ex-Zend Framework) ecosystem. It provides block ciphers (OpenSSL/Hash adapters), key derivation, symmetric/asymmetric helpers (RSA, Diffie-Hellman), and password hashing adapters (Bcrypt, Apache-style MD5).Illuminate\Encryption\Encrypter (AES-256-CBC/GCM + HMAC, key from APP_KEY) and Illuminate\Hashing\HashManager (Bcrypt, Argon2id, needsRehash). Installing this package creates two parallel crypto stacks in one codebase with different key management, payload formats, and rotation semantics.Integration feasibility
$2y$ hashes, so Laravel's Hash::check() verifies them directly; Hash::needsRehash() + Hash::make() migrates users on next successful login at zero risk. This is the only clean seam.Laminas\Crypt\BlockCipher output is not compatible with Laravel's Encrypter (different envelope, IV handling, and MAC layout). Any existing Laminas-encrypted data requires a bespoke decrypt path.Technical risk
Package is abandoned warnings, and SCA/SCA-gate tooling will flag it. This is a direct control failure for PCI DSS, SOC 2 CC7/CC8, and most enterprise vendor reviews that require maintained cryptography.Key questions
Mcrypt-era or non-standard cipher modes that Laravel cannot express natively?Stack fit
Hash (Bcrypt/Argon2id), with needsRehash for transparent upgrade.Crypt / Encrypter, with per-model or per-tenant key derivation rather than a second library.Illuminate\Encryption, hash_hmac, or a maintained library (paragonie/halite, defuse/php-encryption) if you need a specific primitive Laravel lacks.openssl_* directly or a maintained, scoped library.Migration path
Hash::check, migrate opportunistically on login with needsRehash. Drop the dependency once the shim is unused. Low risk, no downtime.LegacyDecryptor implementing a project-owned interface. Dual-read: try Laravel Crypt first, fall back to legacy, then immediately re-encrypt with the Laravel key and persist. Never dual-write.legacy_ciphertext_remaining). Gate removal of the shim on that metric hitting zero plus a full backup window.composer why laminas/laminas-crypt.Compatibility
needsRehash.Sequencing
Inventory → password-hash migration (parallel, low risk) → legacy ciphertext dual-read + backfill (the long pole) → shim removal → dependency purge. Do the password work first to shrink the surface cheaply; do not start ciphertext backfill until the inventory is complete and the re-encryption job is idempotent and rehearsed on a restored production snapshot.
Maintenance
Support
Scaling
APP_KEY + whatever the Laminas path uses) means duplicated rotation runbooks and duplicated key-compromise blast radius.Failure modes
Crypt, old by Laminas) if dispatch logic is wrong — data loss risk on write paths.Ramp-up
How can I help you explore Laravel packages today?