hamoi1/eloquent-encryptable
hamoi1/eloquent-encryptable adds transparent attribute encryption to Laravel Eloquent models: define encrypted casts and the package encrypts values on save and decrypts them on read, keeping sensitive data secure while preserving normal model usage.
eloquent-encryptable (v0.1.3) let a team satisfy "PII must be encrypted in the database" requirements at the model layer without a schema migration or a database-level encryption project — a fast path for GDPR/CCPA/HIPAA-adjacent obligations on fields such as names, emails, phone numbers, and government IDs.encrypted casts plus key management in every model. A package consolidates that into a trait, which reduces duplicated crypto code — but at v0.1.x it is a source of leverage, not a strategic dependency: plan for the option to fork or vendor it.WHERE, LIKE, sorting, or unique constraints. This package therefore forces an explicit product decision per attribute: encrypt it and lose filtering/reporting, or keep it plaintext and accept the risk. Surface that trade-off before commit, not after.Consider it when:
APP_KEY / encrypter infrastructure and are comfortable with its operational model (key custody, rotation, environment parity).Look elsewhere (or build) when:
To executives: This is a small, low-cost library that lets us encrypt specific sensitive customer fields in the database without a major platform project. It accelerates a compliance checkbox — "PII is encrypted at rest" — for a defined set of columns, and it is reversible: it's a trait on models, not a schema or vendor commitment. The trade-off to fund is that encrypted fields can no longer be searched or filtered directly, so any admin or reporting flow that looks up those fields needs application-side work, and key management becomes a real operational responsibility (losing the key means losing the data). Recommendation: adopt narrowly for a pilot set of fields, pin the version, and treat it as an interim layer.
To engineering: It's a trait that transparently encrypts/decrypts model attributes using Laravel's encrypter. Two constraints drive the design: encrypted columns are unqueryable, so decide per attribute whether you're willing to give up WHERE/LIKE/ORDER BY/unique indexes on it; and key rotation plus historical re-encryption must be designed up front, not retrofit. It's at v0.1.3 with an empty published changelog, so pin the exact version, vendor or fork if it's load-bearing, and add tests around serialization, toArray(), and casts so a silent patch release surfaces immediately. Do not present it as access control — it's encryption at rest only.
How can I help you explore Laravel packages today?