documentSQL Semantics for SQLite
SQL Semantics for SQLite
License: MIT Docs PHP Version Ask DeepWiki
SQL Semantics for SQLite adds SQLite to SQL Semantics: the typed statement models of the official SQLite grammars and the SQLite rules for schema binding. Installing it also installs the shared SQL Semantics runtime, and Dialect::Sqlite selects SQLite 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 |
|---|---|---|
| 3.47.2 | sqlite-3.47.2 | Yes |
Installation
composer require k-kinzal/sql-semantics-sqlite
Usage
use SqlSemantics\Facade\Semantics;
use SqlSemantics\Platform\Sqlite\Dialect;
$statement = (new Semantics(Dialect::Sqlite))->analyze("INSERT OR REPLACE INTO users (id, name) VALUES (1, 'Alice')");
$statement->toString(); // "INSERT OR REPLACE INTO users( id , name ) VALUES( 1 , 'Alice' )"
See the SQL Semantics documentation for statement models and schema binding.
License
MIT License. See LICENSE for details.