aeliot/doctrine-encrypted-types
doctrine/dbal or doctrine/orm for hybrid PHP/Symfony stacks) where sensitive data encryption at rest is required (e.g., PII, payment details, API keys).encrypt() helper) by providing database-level encryption, reducing exposure if application-layer encryption keys are compromised.aeliot/doctrine-encrypted-bundle (v1.0.0+), adding another dependency layer. Bundle may introduce Symfony-style configuration (e.g., YAML/XML), which could clash with Laravel’s PHP-based config.Type classes, DQL queries). May conflict with Laravel’s query builder or raw SQL usage.LIKE operations on encrypted text).symfony/console, symfony/dependency-injection) will integrate more smoothly.encrypt(): Simpler but lacks database-level encryption.tightenco/ziggy + laravel/sanctum: For API token encryption (not field-level).Type implementations: More control but higher dev effort.password, credit_card_number).composer require aeliot/doctrine-encrypted-types aeliot/doctrine-encrypted-bundle
encrypted_ssn).Schema::table() or Doctrine migrations).// Using Doctrine Migrations
$this->addSql('ALTER TABLE users ADD encrypted_ssn VARCHAR(255)');
// Custom script to populate encrypted_ssn from ssn
EncryptedType (e.g., @ORM\Column(type="encrypted_string")).getEncryptedSsn()).WHERE encrypted_field = ? must use plaintext comparison).aeliot/doctrine-encrypted-types and doctrine-encrypted-bundle for security patches.doctrine:query).dd($user->encryptedSsn)).static properties, Redis).pgcrypto) as a fallback.| Failure Scenario | Impact | Mitigation |
|---|---|---|
| Lost encryption keys | Permanent data loss | Backup keys offline; implement key escrow. |
| Doctrine ORM misconfiguration | Corrupted encrypted data | Unit tests for entity mappings. |
| Database corruption | Unreadable encrypted fields | Regular backups; test restore procedures. |
| Key rotation failure | Data becomes unreadable | Automated key rotation with fallback keys. |
| High query latency | Degraded user experience | Optimize queries; consider partial encryption. |
How can I help you explore Laravel packages today?