Skip to content
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.

What's covered in the docs?

  • 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.

Where to go next

Quick reminder

$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.

Clone this wiki locally