aeliot/doctrine-encrypted-contracts
aeliot/doctrine-encrypted-bundle).doctrine/dbal), but not Doctrine ORM itself (which Laravel typically avoids).
defuse/php-encryption, openssl). Compatibility depends on the chosen library.pgcrypto vs. application-side encryption).pgcrypto).pgcrypto) to reduce app-side load?vlucas/phpdotenv + openssl (manual encryption).spatie/laravel-encryption (simpler, but less flexible).| Component | Compatibility | Notes |
|---|---|---|
| Laravel | Partial | Works with Doctrine DBAL (included in Laravel), but no Eloquent integration. |
| Eloquent | Low | Requires custom casts/accessors to map Doctrine types to Eloquent. |
| Doctrine ORM | High | Designed for Doctrine ORM extensions (ideal for hybrid Laravel/Symfony apps). |
| Database | High | Supports any DBAL-compatible DB, but performance varies (e.g., PostgreSQL vs. MySQL). |
| Encryption Libs | Medium | Assumes compatibility with libraries like defuse/php-encryption. |
password, credit_card).composer require aeliot/doctrine-encrypted-contracts
defuse/php-encryption).Aeliot\DoctrineEncryptedContracts\Type\EncryptedType for your use case.use Aeliot\DoctrineEncryptedContracts\Type\EncryptedType;
class CreditCardType extends EncryptedType {
protected function getEncryptionKey(): string { return config('encryption.credit_card_key'); }
}
public function getCreditCardAttribute($value) {
return $this->decrypt($value);
}
protected $casts = [
'credit_card' => EncryptedCast::class,
];
TEXT for encrypted strings).Illuminate\Validation).Illuminate\Http\Resources).Laravel Scout).credit_card) in a non-critical module.pgcrypto) to reduce app-side load.defuse to openssl), you’ll need to rewrite type handlers.How can I help you explore Laravel packages today?