-
-
Notifications
You must be signed in to change notification settings - Fork 3
Home
Greg Bowler edited this page Mar 3, 2026
·
8 revisions
When we introduce a database layer to an application, we usually want two things: tidy query organisation and predictable access patterns. This repository was built with the aim of giving us both.
Here we will organise queries into collections, bind data safely, fetch strongly typed values, and run migrations in a repeatable way.
- Query collections using SQL files or PHP query classes.
- Named and positional parameter binding.
- Type-safe fetching for single values and result sets.
- Multiple named database connections.
- Migration workflow with integrity checks.
- Raw SQL execution for one-off tasks.
- Quick start guide
- Configuration and connections
- Query collections
- Parameter binding
- Type-safe getters
- Raw SQL and result sets
- Database migrations
- Examples
$settings = new Gt\Database\Connection\Settings(
"query",
Gt\Database\Connection\Settings::DRIVER_SQLITE,
"app.sqlite"
);
$db = new Gt\Database\Database($settings);
$row = $db->fetch("user/getById", 42);Move on to the Quick start guide to build the example above out properly.
PHP.GT/Database is a separately maintained component of PHP.GT/WebEngine.