dolphiq/laravel-aescrypt
dolphiq/laravel-aescrypt brings AES Crypt compatible file encryption to Laravel. It offers straightforward facades and helpers to encrypt or decrypt files using AES-256, making secure, standards-compatible file storage easy to add to any Laravel application.
WHERE, ORDER BY, and reporting queries can operate on ciphertext columns via AES_DECRYPT, which the native Laravel encrypted casts cannot do without a separate blind-index column. If the roadmap contains "let support agents search customers by email/phone" over PII that must be encrypted at rest, this pattern is a real (if imperfect) option.AES_ENCRYPT from a pre-Laravel system, this package is a bridge that lets Eloquent models read/write it without a big-bang re-encryption project. That converts a multi-sprint migration into an incremental one — a scheduling and risk decision PMs own.Consider it when most of these hold:
AES_ENCRYPT-encrypted columns, or you are acquiring/merging a system that does, and rewriting the crypto is out of scope.Look elsewhere when:
encrypted / encrypted:array casts (AES-256-GCM, authenticated, APP_PREVIOUS_KEYS rotation) are the correct default. Adding a dependency to get weaker crypto is a net negative.performance_schema, replication binlogs, and APM traces. That is frequently disqualifying, and it is the single most important thing to verify before adoption.AES_ENCRYPT has historically defaulted to ECB and derives keys by padding/truncating — no integrity tag, deterministic ciphertext, equality leakage. If tamper-detection or rotation is a requirement, this is the wrong tool.AES_DECRYPT(col, key) = ? is a full table scan. Above a few hundred thousand rows, this becomes a latency and cost problem, and you should implement blind indexes (e.g., CipherSweet-style) instead.To executives (30 seconds): "We have encrypted customer data in MySQL that our current Laravel app can't search, and two other systems that need to read it. This package lets us query that data directly in SQL instead of building a custom encryption layer or running a multi-month re-encryption migration. It's small and cheap to adopt, but it comes with a real trade-off: the encryption key appears in database query logs, and the encryption mode is weaker than what Laravel ships by default. I recommend we adopt it narrowly — for the legacy columns only — with a security review, a pinned version, and a plan to migrate off it if the vendor disappears. It is a bridge, not a destination."
To engineering (the actual ask): "Evaluate as a scoped adapter for existing MySQL-encrypted columns, not as the encryption strategy. Before we merge: (1) confirm the cipher mode and key handling in the source, not the README; (2) trace exactly where the key appears — general log, slow query log, binlog, APM — and confirm those are locked down or disabled; (3) benchmark AES_DECRYPT filtering at our real table sizes and index strategy; (4) verify Laravel/MySQL version support against our matrix; (5) decide fork-and-own vs. upstream dependency for a security-adjacent package with one maintainer. Any new PII column goes through native encrypted casts with a blind index — this package does not set the pattern."
How can I help you explore Laravel packages today?