codelieutenant/laravel-crypto
Laravel Crypto provides secure, easy-to-use encryption and decryption helpers for Laravel applications. Protect sensitive strings and data with a simple API, configurable keys, and seamless integration into your existing Laravel workflows.
Architecture fit. laravel-crypto is a drop-in extension of Laravel's Encrypter, wired in through the service container and consumed via Eloquent casts/traits. The v3.0.0-alpha1 headline feature — per-user encryption (PR #41) — shifts the package from "one app-wide key" to "a key per user/tenant," which is a materially different architecture: it introduces a key-derivation and key-lookup layer that the application must own. For multi-tenant SaaS or any product with per-customer data-isolation requirements (health, finance, GDPR-scoped records), this is a genuine differentiator over stock Laravel encryption. For single-tenant internal apps, it is largely unnecessary complexity.
Integration feasibility. Low mechanical effort (Composer require, publish config, swap casts), but the real cost sits in key management, not code. Per-user encryption requires deciding where the per-user key material lives (DB, KMS, derived from a master secret + user salt), how it is rotated, and how it is recovered. That design work is ours, not the package's.
Technical risk. High for this release specifically:
Key questions to put to the maintainer / our team:
Stack fit. Assumes Laravel 9–11 and PHP 8.1+, consistent with v2. Confirm the exact constraint from composer.json before committing — alpha releases often bump minimum PHP/Laravel. It slots into existing Eloquent models via casts, so it is additive to the current data layer rather than a rewrite.
Migration path. Treat this as a data migration, not a dependency bump:
Compatibility. The alpha API may move. Pin to an exact alpha tag (not ^3.0@alpha), wrap the package behind our own thin EncryptionService interface so an API change or a swap to an alternative (e.g. Laravel's native encrypted cast + a custom key resolver) is a one-file change. Do not let package classes leak into domain code.
Sequencing.
Maintenance. We inherit a security-critical dependency on an alpha track. Budget ongoing effort for: tracking upstream releases, re-validating ciphertext after any format change, and owning the key-management layer the package does not provide. Pin versions; subscribe to the repo's releases; review every diff that touches key derivation.
Support. Effectively self-support. One active contributor, no vendor SLA, sparse release notes. Our on-call runbook must document decryption failure handling end-to-end, because there is no one to escalate to at 3 a.m. Add a named internal owner for this package.
Scaling. Two new bottlenecks versus v2: (a) key resolution per decrypt — cache per-user keys in memory/Redis with a short TTL, or every model hydration becomes a key-store round trip; (b) key-store availability — if keys live in a DB or KMS, that store is now on the critical path for every read of encrypted data. Load-test decrypt-heavy endpoints (exports, list views) before rollout; per-user key derivation (if KDF-based) is CPU-bound and should be memoized, never recomputed per row.
Failure modes to instrument and rehearse:
Ramp-up. Expect 1–2 weeks for the spike and 3–5 days of engineering for the migration tooling and backfill runbook, plus security review time. The team does not need deep cryptography knowledge to use the package, but it does need enough to own key custody, rotation, and recovery — if that expertise is absent, budget for it or choose a managed KMS-backed alternative. Document the decision and its rationale in an ADR so the next engineer understands why per-user encryption was adopted and what the recovery contract is.
How can I help you explore Laravel packages today?