- Can I use this package with Laravel’s Eloquent ORM, or is it strictly for Doctrine?
- This package is designed for Doctrine ORM and won’t work natively with Laravel’s Eloquent. You’d need a hybrid approach (Doctrine DBAL + Eloquent) or migrate to Doctrine, adding complexity. For pure Eloquent projects, consider alternatives like `spatie/laravel-encryption`.
- What Laravel versions does this package support, and are there any breaking changes?
- The package targets Symfony/Doctrine ecosystems, not Laravel directly. Since it relies on Doctrine, ensure your Laravel app uses Doctrine DBAL or ORM. Check the [UPGRADE.md](https://github.com/dayploy/DayployDoctrineExtensionsBundle/blob/main/UPGRADE.md) for Doctrine-specific BC breaks between v1 and v2.
- How do I configure encryption keys securely in production?
- Generate keys via `./bin/console dayploy:doctrine-extensions:generate` and store them in `.env`. For production, integrate with external key managers like AWS KMS or HashiCorp Vault. Never hardcode keys or commit them to version control.
- Will this package work with my existing database schema, or do I need to migrate?
- You’ll need to add `BINARY` columns for encrypted values and nonces, which may require schema migrations. Existing queries or applications reading plaintext fields will break without updates. Plan for downtime or use a phased migration strategy.
- Does this package handle key rotation automatically, or do I need to manage it manually?
- Key rotation is manual—there’s no built-in mechanism. You’ll need to re-encrypt data when rotating keys, which could be disruptive. Use Laravel’s config or external services (e.g., Vault) to automate this process.
- How does performance compare to Laravel’s built-in `encrypt()` method?
- This package adds overhead due to field-level encryption/decryption during every save/find operation. Laravel’s `encrypt()` is simpler and faster for application-layer encryption, but lacks database-level security. Benchmark both for your use case.
- Are there alternatives for Laravel that offer similar compliance features without Doctrine?
- Yes. For GDPR/HIPAA compliance, consider `spatie/laravel-encryption` (application-layer) or `laravel/bouncer` (row-level security). For database-level encryption, evaluate `tightenco/ziggy` (for URLs) or custom solutions with Laravel’s query builder.
- Can I encrypt non-string fields (e.g., JSON, arrays) with this package?
- No. This package only supports string fields. Non-string data (e.g., JSON, arrays) would require serialization or a different approach. For complex data, consider application-layer encryption or a hybrid strategy.
- How do I test encrypted fields in Laravel’s testing environment?
- Mock the encryption/decryption logic in tests or use a separate test database with pre-encrypted data. Verify edge cases like concurrent writes, partial updates, and nonce collisions. Laravel’s `RefreshDatabase` trait can help reset encrypted states between tests.
- What happens if I lose the encryption key in production?
- Data encrypted with the lost key becomes permanently inaccessible. There’s no recovery mechanism. Store keys securely (e.g., Vault) and document key backup procedures. Test key loss scenarios in staging before production deployment.