pfilsx/postgresql-doctrine
Adds PostgreSQL-specific types, functions, and platform support to Doctrine DBAL, enabling native arrays, JSON/JSONB, hstore, and other rich Postgres features in your entities. A lightweight bridge for projects needing more than Doctrine's built-in Postgres support.
Architecture fit. This is not a Laravel package in the Eloquent sense; it is a Doctrine DBAL/ORM extension that adds PostgreSQL-specific DBAL types (ENUM, arrays, JSON/JSONB, geometric, network types) plus a Doctrine Migrations platform extension and SQL function emulation for aggregates and PG-native functions. It only fits stacks where Doctrine is the persistence layer — a minority pattern in Laravel (typical use is doctrine/dbal for schema introspection alongside Eloquent, or full Doctrine ORM integrations). In a Laravel codebase, the realistic value is narrow: schema introspection of an existing Postgres database that already uses native enums/arrays/JSONB, or teams that have standardized on Doctrine ORM (more common in Symfony and legacy/enterprise PHP). If the target codebase is Eloquent-native, this package solves a problem you don't have, and the correct move is to model those constructs as casts/columns rather than adopt it.
Integration feasibility. Low friction where Doctrine is already in place: register custom types in doctrine.yaml/config/doctrine.php, configure the migrations platform with the custom platform class, and existing entities/migrations pick up the types. Friction is high at the boundaries — every additional Doctrine package increases version pinning surface, and this package must track Doctrine DBAL's internal API (types, platform, schema manager) which changes across major versions.
Technical risk. The dominant risk is adoption and maintainership, not code quality: 3 stars, 0 dependents, single maintainer, one release to date. Mitigating factors: MIT license, small surface area, and the source is fully inspectable and forkable. The functional risk is version coupling to Doctrine DBAL (3.x vs 4.x schema APIs, platform class internals) and to PostgreSQL DDL semantics. The high opportunity score (12.84) with low overall score (0.045) signals a real capability gap in the ecosystem — Postgres-native features are poorly served by stock Doctrine — but an unmet-demand signal is not the same as a proven dependency.
Key questions to resolve before adoption.
jsonb that would surface as data corruption rather than an obvious failure?Stack fit. Adopt only if (a) Doctrine ORM is the persistence layer, and (b) the schema relies on Postgres-native types that stock Doctrine either fails to introspect or mangles during diff. Treat Eloquent-only Laravel apps as out of scope; the cheaper alternative there is raw DDL migrations and model casts.
Migration path.
doctrine:schema:validate and a dry-run migrations:diff against a restored copy of a production schema to confirm the platform doesn't emit destructive or spurious diffs for enums, arrays, and JSONB.Compatibility. Verify the supported Doctrine DBAL/ORM majors and the minimum PostgreSQL version (JSONB requires 9.4+; array and enum handling is stable across 11–16, but ALTER TYPE ... ADD VALUE transaction semantics differ and affect migration reversibility). Confirm PHP version constraints align with the rest of the stack, and check that the migrations bundle (doctrine/migrations) major aligns, since the platform-extension hook has changed version to version.
Sequencing. Because of the low adoption and zero dependents, sequence this as: proof-of-concept against a schema snapshot → internal fork/vendoring decision → non-production integration → production migration of one low-risk table → broader rollout. Do not make this a blocking dependency for a release train; it should be a background enabler. Budget for a one-time code review of the type converters, since there is no downstream base of users stress-testing edge cases.
Maintenance. Expect to self-maintain. There is no vendor, no commercial support, and no community velocity behind 3 stars. Practical stance: fork under the organization, pin to the fork, and budget a small recurring allocation to rebase against Doctrine upgrades. The upside is the license permits this and the code surface is small.
Support. No SLA, no documented escalation path. Issues and PRs on the upstream repo may go unanswered. Internal documentation and a named owner are non-optional; without them this becomes tribal knowledge in one engineer's head.
Scaling. Type conversion is per-row serialization and is generally cheap for JSONB and small arrays, but large array columns and repeated round-trips through custom types add CPU and allocation overhead relative to native driver-level handling. The package pushes query work down to Postgres (aggregates, JSONB operators), which is the right scaling posture. Watch connection pool behavior if migration tooling runs inside app processes.
Failure modes.
ALTER TYPE ADD VALUE inside a transaction is version-sensitive.Ramp-up. Engineers need both Doctrine ORM fluency (unit of work, DBAL types, migrations platform hooks) and practical PostgreSQL DDL expertise (enums, array indexing, JSONB operators). That is a meaningful ramp for a team coming from Eloquent. Estimate a day or two to validate the integration and considerably longer to establish organizational confidence in a dependency with no downstream users. Given the risk profile, the honest recommendation is to treat this as a reference implementation to borrow from or vendor, not as a dependency to adopt wholesale.
How can I help you explore Laravel packages today?