austinheap/laravel-database-encryption
Pros:
passwords, credit_cards) without application-layer changes.encrypt helper) for hybrid approaches.Cons:
LIKE clauses, joins) and indexing.config for encryption keys; no built-in key rotation or hardware-backed key storage (e.g., AWS KMS, HashiCorp Vault).casts improvements, attributes API).spatie/laravel-encryption as an alternative).openssl for encryption; conflicts unlikely unless other packages override App\EncryptsAttributes.| Risk Area | Severity | Mitigation Strategy |
|---|---|---|
| Laravel Version Drift | Critical | Fork/package patch or switch to modern alternative (e.g., spatie/laravel-encryption). |
| Performance Overhead | High | Benchmark queries; consider partial encryption (e.g., only PII). |
| Key Management | Medium | Integrate with external KMS or rotate keys via custom logic. |
| Query Limitations | Medium | Avoid encrypted fields in where, orderBy, or full-text search. |
| Migration Complexity | Low | Use php artisan db:seed to re-encrypt legacy data. |
spatie/laravel-encryption) be prioritized?credit_card_number, ssn).User) to test:
users()->where('email', 'like', '%@example.com')).config/encryption.php to define rules:
'fields' => [
\App\Models\User::class => ['credit_card', 'ssn'],
],
config/services.php or a secrets manager (e.g., AWS Secrets Manager).laravel-shift/laravel-5.5-compatibility) if targeting Laravel 9/10.spatie/laravel-encryption (active maintenance, Laravel 9+ support).cache driver to exclude sensitive fields if using remember() or tagged caching.openssl is enabled in PHP (php -m | grep openssl).composer require austinheap/laravel-database-encryption
php artisan vendor:publish --provider="AustinHeap\DatabaseEncryption\DatabaseEncryptionServiceProvider"
assertEquals('encrypted_value', $user->credit_card)).DecryptException (e.g., corrupted data or wrong keys).$fillable + config).dd($user->getAttribute('credit_card'))).select() clauses).where clauses may silently fail or return no results.How can I help you explore Laravel packages today?