jetiradoro/laravel-encrypt-model
Laravel trait to transparently encrypt specified Eloquent model attributes before saving to the database and automatically decrypt them when accessed. Install via Composer, add the Encryptable trait, and list encrypted fields in the $encryptable array.
$encryptable), reducing scope creep.encrypt()). No support for custom algorithms (e.g., AES-256-GCM, PGP) or key management.APP_KEY). Risk of key rotation or compliance issues (e.g., GDPR, HIPAA).where('cc', 'LIKE', '%123%')), limiting use cases for sensitive searchable data.APP_KEY; no support for per-field keys or hardware-backed keys (HSMs).encrypted:... in JSON fields (visible in logs, dumps, or debug tools) unless explicitly masked.save()/find() call. Benchmarking required for high-write workloads.APP_KEY changes post-encryption).APP_KEY secured and rotated? Is it stored in a secrets manager (e.g., AWS Secrets Manager)?APP_KEY is lost?pgcrypto, Transparent Data Encryption) or a dedicated library (e.g., Defuse/PHP-Encryption) be more suitable?APP_KEY rotation?User profile fields) to validate performance and security.$encryptable to models in phases, prioritizing high-sensitivity fields.schema_migrations table or comments.is_encrypted column if dynamic field encryption is needed later.APP_KEY is securely stored (e.g., environment variables, secrets manager).Encryptable trait and $encryptable to target models.trait and factory tests for encryption/decryption.APP_KEY will break decryption for existing data unless a migration strategy is implemented.APP_KEY changes or corruption.$encryptable arrays (e.g., forgetting to include a field).APP_KEY changes, re-encrypt data via a migration").monolog channel).APP_KEY.APP_KEY.| Failure Scenario | Impact | Mitigation |
|---|---|---|
APP_KEY lost/corrupted |
Permanent data loss for encrypted fields | Regular backups + key rotation documentation. |
| Database corruption in encrypted fields | Decryption failures | Use database backups + checksums. |
| Key rotation without re-encryption | Data becomes unreadable | Automate re-encryption via migrations. |
| High write load | Increased latency | Queue encryption tasks. |
| Dependency vulnerability | Security breach | Monitor for CVE updates (low stars = low visibility). |
$encryptable convention and encryption behavior (e.g., "fields are encrypted at rest and decrypted on access").APP_KEY (e.g., in Git, logs).How can I help you explore Laravel packages today?