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 For this package there is no description available.
License
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
For in-depth description of package features, visit pg_gateway manual.
Requirements
pg_gateway requires at least PHP 8.2 with native pgsql extension.
Minimum supported PostgreSQL version is 12.
It is highly recommended to use PSR-6 compatible cache in production, both for metadata lookup and for generated queries.