Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Doctrine Encrypted Bundle

Doctrine Encrypted Bundle Laravel Package

aeliot/doctrine-encrypted-bundle

Symfony bundle that adds Doctrine column types for encrypting individual database fields. Install via Composer, configure your key and mappings, and store encrypted values transparently. Notes on DB charset/collation (utf8mb4) for reliable sizing.

View on GitHub
Deep Wiki
Context7

The bundle permits to encrypt separate columns of database via Doctrine column types

Frequently asked questions about Doctrine Encrypted Bundle
Can I use this package in Laravel without Symfony, or is it strictly for Symfony/Doctrine projects?
This bundle is designed for Symfony/Doctrine and won’t work natively in Laravel without a Doctrine ORM bridge like `laravel-doctrine/orm`. You’d need to manually integrate Doctrine’s DBAL types into Laravel’s ecosystem, which may require custom service providers or hybrid Eloquent-Doctrine models. Test compatibility thoroughly before adoption.
How do I encrypt specific columns in Laravel models using this bundle?
First, install the bundle via Composer and configure Doctrine ORM in Laravel. Then, define custom Doctrine column types (e.g., `EncryptedType`) in your entity mappings. The bundle handles encryption/decryption transparently during read/write operations—no manual logic needed in your model code, but ensure your database uses `utf8mb4` charset/collation for stable storage.
Will encrypted columns break Laravel’s query builder or Eloquent relationships?
Yes, encrypted columns may conflict with Laravel’s query builder (e.g., `DB::select`) since it doesn’t natively support Doctrine types. For Eloquent relationships, you’ll need to use Doctrine entities exclusively for encrypted fields or implement custom accessors. Test queries involving encrypted columns early to avoid runtime errors.
What Laravel versions and Doctrine ORM versions are supported?
This bundle requires **Doctrine ORM 2.10+** and works with **Laravel 10+**, but only if you’ve already integrated Doctrine via a bridge like `laravel-doctrine/orm`. Pure Eloquent apps are unsupported. Check the [docs](https://github.com/Aeliot-Tm/doctrine-encrypted-bundle/blob/main/docs/index.md) for version-specific setup instructions.
How do I handle encryption key management in production?
The bundle doesn’t include built-in key management—you’ll need to integrate an external solution like AWS KMS, HashiCorp Vault, or Laravel’s config/cache. Store keys securely and implement rotation logic separately. Avoid hardcoding keys in environment files or version control.
Are there performance implications for encrypted columns in Laravel?
Encrypted columns can slow down queries (e.g., indexing, joins) and increase storage size due to variable-length ciphertext. Test with your workload, especially for frequently queried fields. Consider using this bundle only for highly sensitive data (e.g., PII) where security outweighs performance trade-offs.
Can I migrate existing Laravel tables to use encrypted columns without downtime?
Migrating encrypted columns requires careful schema changes, including backfilling data and updating `utf8mb4` collation. Plan for downtime or use a hybrid approach: add encrypted columns alongside existing ones, then transition gradually. Backup your database before migration.
Does this bundle work with Laravel’s caching (Redis, file cache) or Scout for search?
No, encrypted data may not play well with Laravel’s cache drivers (e.g., Redis) or Scout’s full-text search, as these systems expect plaintext. Avoid caching or searching encrypted columns directly. Use application-layer caching for decrypted data instead.
What are the alternatives to this bundle for Laravel column encryption?
For Laravel-native solutions, consider `spatie/laravel-encryption` (simple field encryption) or `paragonie/vault` (advanced key management). If you’re already using Doctrine, this bundle offers deeper integration but adds complexity. Evaluate your needs: native Eloquent solutions may suffice for basic use cases.
How do I test encryption/decryption in Laravel’s CI pipeline?
Add Doctrine-specific tests to your CI pipeline, focusing on encryption/decryption round-trips and edge cases (e.g., corrupted keys). Use Laravel’s `DatabaseMigrations` or `DatabaseTransactions` to test schema changes. Validate that encrypted data persists correctly across restarts and backups.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
besmartand-pro/php-quality-config
sentix/ai-chatbot
terminal42/code-quality-tools
codifyo/ts-generator-bundle
testo/fiber
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity