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 Generic Types Laravel Package

vanio/doctrine-generic-types

Adds support for generic types in Doctrine mappings, letting you declare typed collections and associations for better static analysis and IDE autocompletion. Integrates with PHPStan and Psalm to catch type errors in your entities early, with minimal setup and no changes to how your entities behave...

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture fit — weak for a standard Laravel stack. This is a Doctrine DBAL extension that hooks into the low-level type registry. Laravel's default persistence layer is Eloquent over PDO, which never consults DBAL's type map. The only place doctrine/dbal appears in a typical Laravel app is as a transitive dependency of the schema builder (for ->change() column modifications). That surface does not exercise custom generic types. Real fit exists only in Laravel applications running Doctrine ORM via laravel-doctrine, which is a minority configuration.

Integration feasibility — conditional and narrow. Adoption is viable only where the team already owns a Doctrine ORM entity layer and has a concrete need for parameterized/composed column types (e.g., a type that wraps another with a length, precision, or encoding parameter). For everyone else the package adds a global registration side effect with no consumer. Note that the exact semantics of "generic types" here are under-documented relative to what a reviewer needs; a spike must confirm whether it solves a problem the team actually has versus one it merely names.

Technical risk — high relative to value.

  • Bus factor and liveness: 0 stars, 0 dependents, single-vendor origin. Treat as effectively unmaintained source you would fork, not a dependency you consume.
  • Version compatibility: DBAL's type registration API has churned across major versions (Type::addType semantics and availability changed into the 3.x/4.x line). A package pinned to an older DBAL major is a blocker on modern Laravel, and one that mutates a process-global type registry can collide with other extensions.
  • Migration/schema-diff risk: custom DBAL types participate in schema comparison. A subtly wrong getMappedDatabaseTypes or convertToDatabaseValue produces spurious diffs or silent truncation — the worst class of bug because it surfaces in production data, not in tests.
  • Low opportunity signal (17) plus zero dependents is consistent with "solves a niche problem for one team."

Key questions to resolve before any commitment:

  1. Which Doctrine DBAL and PHP majors are supported, and does the registration mechanism survive the target DBAL version?
  2. Does the type registration happen globally at boot, and is it idempotent and collision-safe?
  3. Are the generic types round-trip safe under the schema comparator, and what is the test coverage?
  4. Is there a maintained upstream alternative (native DBAL type composition, custom Type subclasses registered per-connection) that removes the dependency entirely?
  5. Who owns the fork, and what is the patch SLA?

Integration Approach

Stack fit. Restrict evaluation to services on laravel-doctrine (or standalone Doctrine ORM) where the entity layer is already Doctrine-managed. Exclude from any Eloquent-first application — the dependency would be dead weight and a registry-mutation liability.

Migration path. There is no migration in the conventional sense; this is additive wiring. The realistic sequencing is: (1) prove the type is needed by writing the custom DBAL type inline in the application first; (2) only if the generic abstraction demonstrably removes duplicated type classes across several entities, evaluate the package as a replacement; (3) vendor or fork under an internal namespace rather than depending on the public package.

Compatibility. Verify against the exact DBAL major pulled in by the app's composer.lock before writing any code — this is a gate, not a detail. Confirm interaction with the schema builder used for Laravel migrations so that custom types do not leak into Schema::table diffs on unrelated tables.

Sequencing. Pilot in a single non-critical bounded context with its own migration history. Instrument schema-diff output in CI (fail the build on unexpected doctrine:schema:update --dump-sql) before promoting to core domains. Do not sequence this alongside a Laravel or PHP major upgrade — decouple the two so failures are attributable.

Operational Impact

Maintenance. Assume you own it. Budget for a fork, an internal owner, and periodic rebases against DBAL majors. The cost is small in lines but recurring, and it is exactly the kind of maintenance that gets deprioritized until a PHP upgrade forces it.

Support. None external. Zero dependents means zero community signal on breakage; issues will be discovered by your team, in your environment. Weigh this against the alternative of a ~50-line in-house Type subclass with no third-party surface.

Scaling. Runtime overhead is negligible — type conversion is per-value and cheap. The scaling concern is organizational: each additional service that adopts the package multiplies fork-maintenance cost without multiplying benefit.

Failure modes.

  • Silent value corruption from imprecise conversion (truncation, locale/encoding drift) — highest severity, lowest detectability.
  • Global type-registry collision causing unrelated entities to fail conversion after an unrelated package update.
  • Schema comparator drift producing phantom or missing migrations.
  • Abandonment: the package stops tracking DBAL, blocking a framework upgrade on a dependency nobody remembers adding.

Ramp-up. Low code volume, high conceptual prerequisite: the team needs DBAL type-system fluency (mapping, conversion, comparator contracts) that most Laravel developers have not built. Expect the learning cost to exceed the integration cost.

Recommendation. Do not adopt as a dependency. Use it as a reference implementation to inform an in-house custom Type, and revisit only if the Doctrine ORM footprint grows and the generic abstraction proves itself against three or more real type variants. Score (0.03) and zero dependents are consistent with this read.

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.
octoberrain/html
octoberrain/extension
octoberrain/exception
octoberrain/contracts
frankyso/ipaymu
3mdikram/worldmoneywords
snowsoft/config
itmosoft/laravel-subscriptions
larva/laravel-ai-qwen
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