Weave 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 Encryption Extension Laravel Package

ywh/doctrine-encryption-extension

ywh/doctrine-encryption-extension adds transparent field-level encryption to Doctrine entities, with configurable DBAL types and event subscribers for securely storing sensitive data in PHP applications.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture fit. This is a Doctrine ORM extension, not a Laravel/Eloquent package. It hooks Doctrine's event system (metadata driver + lifecycle events) to transparently encrypt annotated entity properties on flush and decrypt them on hydration. That means it fits only if the target application already runs Doctrine inside Laravel (via laravel-doctrine/orm) or is a Symfony/standalone Doctrine codebase. For a conventional Eloquent-based Laravel app, the architectural fit is poor: adopting this package implies adopting Doctrine as a second ORM alongside Eloquent, which is a much larger decision than "add field-level encryption."

Integration feasibility. Mechanically straightforward in a Doctrine context: register an event subscriber, mark sensitive properties with the package's annotation/attribute, supply a key and cipher configuration, and register the metadata driver. In Laravel this requires custom service-provider wiring and configuration plumbing that the package does not ship. There is no Laravel service provider, no config file, no facade, no published migrations — all glue code is the adopter's responsibility.

Technical risk.

  • Zero adoption signal. 0 stars, 0 dependents, score 0. There is no evidence of production use anywhere, no downstream compatibility testing, and no community to surface bugs. Treat it as a reference implementation, not a dependency.
  • Security-critical code with no audit. The package is inherently in the trusted computing base for data confidentiality. Encryption extensions are exactly where nonce/IV reuse, padding, and key-derivation mistakes are catastrophic and silent. Nothing indicates a third-party review.
  • Key management is out of scope. The package appears to take a symmetric key from configuration. It does not solve envelope encryption, KMS/HSM integration, rotation, or per-tenant key isolation — which is where 80% of the real operational risk lives. A raw key in .env is the likely default, and that is a materially weaker posture than the encryption suggests.
  • Ciphertext has different query semantics. Encrypted columns cannot be LIKE-searched, range-filtered, sorted, or joined on. Without a blind-index/searchable-encryption feature, any existing query touching the column breaks or must move to the application layer.
  • Storage expansion. Base64/hex-encoded ciphertext with IV and tag typically inflates column size 2–4x. VARCHAR(255) columns silently truncate or error depending on strict mode.

Key questions.

  1. Is the target codebase actually on Doctrine, or is this being evaluated for an Eloquent app?
  2. Which fields are in scope, and are any of them used in WHERE, ORDER BY, JOIN, or unique constraints today?
  3. What is the key custody model — env var, KMS, per-tenant DEKs — and who owns rotation?
  4. Does the package support PHP 8 attributes and current Doctrine ORM/DBAL majors, or is it annotation-era only?
  5. Has any security review been performed, and is there a documented disclosure process?
  6. Is the requirement "encrypt at rest" (which the database/KMS can satisfy) or "protect from DBAs and backups" (which requires app-layer crypto)? This distinction often eliminates the need for the package entirely.

Integration Approach

Stack fit. Assess against the actual runtime:

Dimension Fit Note
Eloquent-only Laravel app Poor Requires introducing Doctrine; disproportionate
Laravel + laravel-doctrine/orm Moderate Native use case, but still custom provider wiring
Symfony / standalone Doctrine Good Intended environment
Mixed Eloquent + Doctrine Risky Two persistence paths over the same tables; encryption only applies to one

Migration path.

  1. Classify before encrypting. Inventory candidate columns and their query surface. Any column in a hot filter/sort path is a no-go without blind indexing; scope those out or accept an application-side filtering redesign.
  2. Prefer greenfield columns. Add new TEXT/LONGTEXT (or BLOB) companion columns rather than widening existing ones under load. On MySQL, TEXT avoids index-length and row-size cliffs.
  3. Backfill via queued jobs. Write a dual-read reader (decrypt if ciphertext, pass through if plaintext) and a batch backfill, then flip a flag to encrypt-on-write, then drop plaintext after a verified soak period. Do not attempt an in-place ALTER + rewrite on large tables.
  4. Exercise rotation before go-live. If the package cannot re-encrypt under a new key, establish a manual re-encryption job now. Discovering this during an incident is the common failure.

Compatibility. Pin explicitly and verify against the Laravel/Doctrine version matrix: PHP minor (attributes require 8.0+), Doctrine ORM major (event system changed across 2.x/3.x), DBAL type mapping, and whether the metadata driver still uses doctrine/annotations (deprecated in favor of attributes). Test against the exact DB engine and strict-mode settings — truncation behavior differs between MySQL and PostgreSQL.

Sequencing. Ship in this order: (1) Doctrine integration and subscriber wiring with a no-op cipher to prove lifecycle hooks fire correctly on insert/update/hydrate; (2) key management and rotation design; (3) encryption on one low-risk column end-to-end in staging; (4) query-surface remediation; (5) production backfill. Treat step 1 as a spike whose exit criterion is "we understand exactly which events fire on our entities" — that knowledge is what makes the vendor risk tolerable.

Recommendation on sourcing. Given zero adoption and the security-critical surface, benchmark against paragonie/ciphersweet (blind indexing, mature audit trail, framework-agnostic) and a hand-rolled Eloquent custom cast wrapping sodium_crypto_secretbox for Eloquent apps. If this package is chosen, vendor it (copy into the repo) rather than depend on it, so upstream abandonment cannot block a security patch.

Operational Impact

Maintenance. Effectively unmaintained by any reasonable definition: no dependents means no one is filing issues, no release cadence is visible, and the maintainer's incentive (a bug-bounty platform publishing an internal utility) does not extend to supporting external consumers. Plan for the fork to be yours. Budget ongoing ownership: PHP/Doctrine major upgrades, cipher deprecations in OpenSSL/sodium, and dependency CVEs in a package that touches cryptography.

Support. No SLA, no security contact documented, no CVE history to assess responsiveness. For a component in the confidentiality path, absence of a disclosure process is itself a finding. Escalation path is "read the source."

Scaling. Encryption cost is per-value per-row on write and per-row on read; for typical payloads this is noise against network I/O, but it becomes visible in bulk export, report generation, and queue workers hydrating large result sets. The bigger scaling issue is architectural: losing server-side filtering on encrypted columns pushes predicates into PHP, which turns indexed queries into full scans plus memory pressure. Quantify this before committing — a 10M-row table filtered in application code will not scale, and no amount of tuning fixes it.

Failure modes.

  • Key loss = permanent data loss. No recovery path exists at the application layer. Backups of the ciphertext are worthless without key custody guarantees; the KMS/secret store becomes a Tier-0 dependency with its own DR plan.
  • Key compromise = retroactive exposure. Without rotation tooling, a leaked key exposes the full history, not just current data.
  • IV/nonce reuse. If the package's cipher handling is flawed or misconfigured, confidentiality degrades silently with no runtime symptom.
  • Schema drift. Adding the annotation to an existing column of insufficient length causes truncation or hard failures on write — often only under specific payload sizes in production.
  • Read-path regressions. Hydration-time decryption failures surface as broad, confusing entity-load errors rather than localized crypto errors, extending mean time to diagnosis.
  • Leakage around the edges. Decrypted values flow into logs, Telescope, query logs, queue payloads, and error trackers. The package encrypts the column, not the application; redaction must be handled separately.

Ramp-up. Low code-learning curve (annotation + subscriber), high organizational learning curve (key custody, rotation drills, incident response for crypto failure, query-surface constraints communicated to every engineer who writes a repository method). Estimate the real cost as key-management engineering plus a query audit, not package integration — and staff accordingly. The most likely correct outcome of this evaluation is "adopt the pattern, not the package."

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.
diephp/sequences
users-au/socialite-provider
twidpay/twid-logger
mrnewport/laravel-plaid
mrnewport/laravel-repo
mrnewport/laravel-docsign
mrnewport/laravel-stow
mrnewport/laravel-flow
mrnewport/laravel-priceable
mrnewport/laravel-nestedterms
fredmeng/laravel-apidoc-generator
itstructure/laravel-multilingual-tools
pdustdar/elasticsearch
markupai/php-sdk
rlacerda83/lumem-microservice-shipment
uni-method/symfony-lib
tacticmedia/scim-server-bundle
neika-ai/symfony-bundle
mattleads/agent-publishing-bundle
glavweb/framework-bundle