sidus/encryption-bundle
Sidus Encryption Bundle is a Symfony/Doctrine integration for transparent field-level encryption, automatically encrypting and decrypting sensitive entity fields so data is protected at rest while application code keeps using normal entity properties.
libsodium/defuse/php-encryption directly, or push the obligation to infrastructure. For a Laravel/Eloquent roadmap, the answer is almost always "a native cast plus KMS," which is a week of work and stays under your license.WHERE, ORDER BY, LIKE, unique constraints, or reporting. Adopting this pattern forces a decision per attribute: stay plaintext, or move to a blind-index column (deterministic HMAC of the normalized value). That constrains future feature requests like "let support filter by email domain" and should be documented before any field is encrypted, not after.Consider it only if:
Look elsewhere if:
EncryptedCast on libsodium secretbox, model observers, or a mutator with envelope encryption — are cheaper, testable, and yours. Eloquent has no hydration-stage interceptor, so the bundle's core mechanism has no direct analogue anyway.To executives: This is a small, single-maintainer Symfony/Doctrine library that encrypts individual database columns and attached files before they reach storage. It solves a narrow but real compliance problem — "if someone walks off with a database dump, this PII is unreadable" — without changing database platforms, and it's a useful design reference for how to do that. It is not a Laravel package, it is GPL-2.0, and it has essentially no adoption, which means adopting it means owning cryptographic code we'd have to maintain, upgrade, and audit ourselves with no upstream security response. Recommendation: do not adopt as a dependency; treat it as a pattern source. The compliance outcome we need is better delivered by managed database and storage encryption plus a small first-party encryption cast built on libsodium and backed by our cloud KMS — roughly a week of engineering, fully under our license and control, with no bus factor — plus a documented decision on which fields can never be filtered or sorted.
To engineering: The bundle's only real contribution is Doctrine lifecycle hooks that transparently encrypt on persist and decrypt on hydrate, plus an encrypted-file abstraction using a hybrid RSA+AES scheme and per-entity key association. That is not a large amount of code, and the parts we would actually depend on — cipher choice, nonce handling, key derivation, rotation — are precisely the parts we should not inherit from an unmaintained third party. A credible Laravel-native equivalent is 200–400 lines: an EncryptedCast using secretbox or AES-256-GCM, a per-record data key wrapped by a KMS/Vault master key and cached per request, a Flysystem decorator so file encryption streams identically on S3 and local, and blind-index columns where search is required. Where we should learn from it: the hybrid file-encryption approach, per-tenant key scoping, and explicit scoping of encrypted fields. Where we must do better: keys must live in KMS, not the application database; we need a tested key-restore and rotation runbook before the first field ships; and we should pilot on one low-risk PII field behind a flag to verify serialization, log redaction, and queue payloads before backfilling. If we were a Symfony/Doctrine shop with a hard field-level encryption mandate and no KMS budget, it's a reasonable two-day spike — we are neither.
How can I help you explore Laravel packages today?