caeligo/field-encryption-bundle
prePersist, preUpdate) for transparent encryption/decryption, minimizing invasive changes to business logic.#[Encrypted] and #[EncryptedFile] attributes enable declarative security, reducing boilerplate and improving maintainability. This is particularly valuable for large codebases where encryption logic might otherwise be scattered.encrypt()/decrypt() calls required. Existing queries (e.g., findBy) work as-is due to HMAC-based searchability for strings.WHERE clauses on encrypted strings). The bundle provides a FieldEncryptionExtension for basic support.OneToMany/ManyToOne relations with BinaryBlobType or StringType for base64). Metadata (MIME type, filename) is stored separately, which is critical for file uploads/downloads.LIKE, ILIKE). The bundle provides HMAC-based partial matching, but complex searches may require application-layer filtering.Collection changes in 2.14+). May need polyfills for older PHP versions.BLOB/BYTEA types for encrypted binaries. May need adjustments for object storage (e.g., S3).composer require caeligo/field-encryption-bundleconfig/bundles.php.config/packages/field_encryption.yaml (e.g., key paths, compression settings).#[Encrypted] to sensitive string fields (e.g., password, creditCardNumber).#[EncryptedFile] to file upload fields (e.g., profilePicture, resume).#[ORM\Entity]
class User {
#[ORM\Column]
#[Encrypted]
private string $ssn;
#[ORM\Column(type: 'string', length: 255)]
#[EncryptedFile]
private string $filePath;
}
php bin/console field-encryption:generate-key to create a master key.field_encryption.key_path.#[Encrypted] attribute and let Doctrine handle it on next update).field-encryption:migrate command (if available).StoDoctrineExtensions). Test for priority conflicts.FileType will work, but custom validation may be needed for encrypted metadata.#[ApiProperty] compatibility).FieldEncryptionExtension for basic support.How can I help you explore Laravel packages today?