maize-tech/laravel-encryptable
Laravel Encryptable adds transparent encryption for Eloquent model attributes, keeping sensitive data secure at rest while preserving a familiar query workflow. A simple trait and cast setup lets you encrypt, decrypt, and search encrypted values without restructuring your models or database.
Crypt::encryptString calls scattered across services. Prefer this over bespoke encryption unless you need field-level access policies or searchable range queries.Consider adoption when:
APP_KEY/config.$casts and incremental rollout — you can encrypt one model at a time rather than doing a migration big-bang.Look elsewhere when:
LIKE queries on encrypted data. Deterministic hashing gives equality only; ordering and partial matching will require a different design (application-level indexing, a search service, or a purpose-built searchable-encryption product).Release-specific note: 4.1.0 is a compatibility and maintenance release — Laravel 13 and PHP 8.5 support, plus a CI dependency bump. No breaking changes, no deprecations, no new features. Low upgrade risk from 4.0.0, but the practical takeaway is stability, not new capability: plan accordingly and do not expect upstream to close the gaps listed above.
For executives: We can meet our data-at-rest encryption obligations for sensitive customer fields without a dedicated platform project. This is an existing, actively maintained open-source component that plugs into our current Laravel codebase; the latest release confirms it stays compatible with the Laravel 13 and PHP 8.5 upgrades already on our roadmap, so it does not create a future migration liability. Estimated effort is a per-model change rather than new infrastructure. Two constraints to note: it supports exact-match search on encrypted fields but not free-text or range queries, and key management stays with us — if we later need per-tenant keys or an HSM-backed rotation policy, that becomes separate scoped work.
For engineering: Use the package's trait and cast to encrypt sensitive attributes at the model layer, keeping key handling on Laravel's existing config. It gives us consistent IV handling and a searchable-hash companion column for exact-match lookups, replacing the ad-hoc Crypt:: calls and hand-rolled searchable columns we tend to accumulate. Version 4.1.0 adds Laravel 13 and PHP 8.5 support with no breaking changes, so it is safe to adopt alongside the framework upgrade. Be explicit in code review about which columns are searchable — deterministic hashes leak equality, so anything that does not need lookup should be encrypted non-searchably. If a feature needs range queries, sorting, or LIKE on an encrypted field, raise it early: that is a design change, not a package configuration.
How can I help you explore Laravel packages today?