Download the PHP package sad_spirit/pg_gateway without Composer
On this page you can find all versions of the php package sad_spirit/pg_gateway. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download sad_spirit/pg_gateway
More information about sad_spirit/pg_gateway
Files in sad_spirit/pg_gateway
Package pg_gateway
Short Description Table Data Gateway implementation for Postgres based on pg_builder, mix and match manually written SQL with query builder API
License BSD-2-Clause
Homepage https://github.com/sad-spirit/pg-gateway/
Informations about the package pg_gateway
sad_spirit/pg_gateway
This is a Table Data Gateway implementation built upon pg_wrapper and pg_builder packages.
Using those packages immediately allows
- Transparent conversion of PHP types to Postgres types and back;
- Writing parts of the query as SQL strings while later processing those parts as Nodes in the Abstract Syntax Tree.
Installation
Require the package with composer:
Design goals
- Code generation is not necessary, default gateway implementations are useful as-is.
- Gateways are aware of the table metadata: columns, primary key, foreign keys.
- It is possible to cache the generated SQL, skipping the whole parsing/building process.
- API encourages building parametrized queries.
- Queries built by several Gateways can be combined via joins /
EXISTS()
/ etc.
Usage example
Assuming the following database schema
we can use default gateways and default builders to perform a non-trivial query to the above tables
where the last two echo
statements will output something similar to
Documentation
- Package overview
TableLocator
class- Working with table metadata
TableGateway
interface and its implementations- Fluent Builders
-
FragmentBuilder
implementations - Query fragments: base interfaces, parameters, aliases
Fragment
implementationsCondition
classes
Requirements
pg_gateway
requires at least PHP 7.4 with native pgsql extension.
Minimum supported PostgreSQL version is 10.
It is highly recommended to use PSR-6 compatible cache in production, both for metadata lookup and for generated queries.
All versions of pg_gateway with dependencies
ext-pgsql Version *
sad_spirit/pg_builder Version ^2.4
sad_spirit/pg_wrapper Version ^2.4