packagek-kinzal/sql-semantics-postgres
PostgreSQL statement models, SQL reconstruction, and schema binding for SQL Semantics
Namespaces§
| SqlSemantics\Platform\PostgreSql | 5 classes 1 enum |
| SqlSemantics\Statement\Model\PostgreSql\Choice | 106 enums |
| SqlSemantics\Statement\Model\PostgreSql\Contract | 1 class |
| SqlSemantics\Statement\Model\PostgreSql\Role | 725 interfaces |
| SqlSemantics\Statement\Model\PostgreSql\Value | 2627 classes |
Documents 1§
| SQL Semantics for PostgreSQL | README.md |
README§
SQL Semantics for PostgreSQL
License: MIT Docs PHP Version Ask DeepWiki
SQL Semantics for PostgreSQL adds PostgreSQL to SQL Semantics: the typed statement models of the official PostgreSQL grammars and the PostgreSQL rules for schema binding. Installing it also installs the shared SQL Semantics runtime, and Dialect::PostgreSql selects PostgreSQL in the runtime's Semantics, Schema, and Binder. No database connection is needed.
Requirements
- PHP 8.1+ with the zlib extension
Support Syntax
The following grammar versions are supported. Pass the version tag as the second argument of Semantics or the third argument of Schema; omitting it uses the default.
| Version | Version tag | Default |
|---|---|---|
| 17.2 | pg-17.2 | Yes |
Installation
composer require k-kinzal/sql-semantics-postgres
Usage
use SqlSemantics\Facade\Semantics;
use SqlSemantics\Platform\PostgreSql\Dialect;
$statement = (new Semantics(Dialect::PostgreSql))->analyze("INSERT INTO users (id, name) VALUES (1, 'Alice') RETURNING id");
$statement->toString(); // "INSERT INTO users ( id , name ) VALUES( 1 , 'Alice' ) RETURNING id"
See the SQL Semantics documentation for statement models and schema binding.
License
MIT License. See LICENSE for details.