sad_spirit/pg_wrapper
A modern, object-oriented wrapper around PHP's pgsql extension for PostgreSQL, offering connection management, parameterized queries, result iteration, automatic type conversion, and support for custom and async queries.
array, enum, composite, range, hstore, json, geometric, or network types either writes its own conversion layer or adopts something like this. This package is the "buy" option: it replaces an in-house parser with a maintained, BSD-2 licensed library.TEXT/JSON columns because PHP-side handling is painful. Low-friction type conversion makes native ENUM state machines, TSTZRANGE scheduling windows, composite address/money types, and array-valued tags cheap to adopt, which changes the data-model argument in design reviews.ext-pgsql, not PDO. Choosing it is implicitly a decision to bypass PDO — and therefore Eloquent's connection, transaction, and query-builder stack — for the queries that need it. That's a real architectural fork worth logging in an ADR.Adoption criteria — pursue a spike when most of these hold:
Look elsewhere when:
For executives (one paragraph): We have a recurring engineering tax: every time we want to use a real Postgres feature — arrays, enums, ranges, composite types — someone writes and maintains conversion code, and it breaks in production. sad_spirit/pg_wrapper is a small, permissively licensed (BSD-2) library that already solves this, letting us model data natively in Postgres instead of flattening it into text and JSON columns. Expected benefit is reduced custom code and fewer data-shape bugs, at effectively zero licence cost. The trade-off is dependency risk: it is a low-adoption, single-maintainer project, so the recommendation is a short, time-boxed spike plus an internal wrapper class that isolates us from it — roughly two engineer-days of insurance against a rewrite we would otherwise own indefinitely.
For engineering (bullets):
ext-pgsql with a pluggable type-conversion layer: arrays, enums, composites, ranges, hstore, JSON, geometric and network types map to and from proper PHP values instead of strings.TypeBridge/repository interface so the surface area is a handful of call sites, and add integration tests against the real schema in CI.How can I help you explore Laravel packages today?