{"repo":"sad-spirit/pg-wrapper","free":true,"listed":false,"github":"https://github.com/sad-spirit/pg-wrapper","clone":"git clone https://github.com/sad-spirit/pg-wrapper.git","description":"Converter of complex PostgreSQL types and an OO wrapper for PHP's pgsql extension","language":"PHP","stars":22,"topics":["php","postgresql","postgres","complex-types","array","json","hstore","geometric","datetime","interval"],"license":"BSD-2-Clause","category":"databases-storage","readme_excerpt":"sad spirit/pg wrapper This package has two parts and purposes Converter of PostgreSQL data types to their PHP equivalents and back and An object-oriented wrapper around PHP's native pgsql extension. While the converter part can be used separately e.g. with PDO, features like transparent conversion of query results work only with the wrapper. Why type conversion? PostgreSQL supports a large (and extensible) set of complex database types: arrays, ranges, geometric and date/time types, composite (row) types, JSON... Unfortunately neither of PHP extensions for talking to PostgreSQL (pgsql and PDO pgsql) can map these complex types to their PHP equivalents. They return string representations instead: both and yield And that is where this library kicks in: yields Note that no configuration is needed here: proper types are deduced from metadata returned with the result. Why another wrapper when we have PDO, Doctrine DBAL, etc? The goal of an abstraction layer is to target the Lowest Common Denominator, and thus it intentionally hides some low-level APIs that we can use with the native extension and / or adds another level of complexity. PDO does not expose pg query params() , so you have to prepare() / execute() each query even if you execute() it only once. Doctrine DBAL has Connection::executeQuery() but it uses prepare() / execute() under the hood. Postgres only supports $1 positional parameters natively, while PDO has positional ? and named :foo parameters. PDO rewrites the quer","default_branch":null,"files":null,"tree":[],"storefront":"/r/sad-spirit","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/sad-spirit/pg-wrapper/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}