Skip to content

Examples

Greg Bowler edited this page Aug 31, 2026 · 3 revisions

The example/ directory is the quickest way to see the library running without building a full project first.

Run an example from the repository root:

php example/01-quick-start.php

Each example creates its own temporary workspace, writes the queries it needs, and removes the files afterwards.

Example index

  1. example/01-quick-start.php Basic CRUD with SQL query files.
  2. example/02-parameter-binding.php Positional, named, special, and array-expanded bindings.
  3. example/03-type-safe-getters.php Typed fetch helpers and typed row access.
  4. example/04-dynamic-bindings.php __dynamicIn and __dynamicOr.
  5. example/05-database-migrations.php Running canonical SQL migrations through Migrator.
  6. example/06-multiple-connections.php Named connections and switching between collections.
  7. example/07-php-query-collections.php PHP-backed query collections with a custom namespace.
  8. example/08-sqlbuilder-query-collections.php Query methods built with phpgt/sqlbuilder.
  9. example/09-sqlbuilder-overrides-and-reports.php SQL overrides alongside a PHP query collection.

Note

These examples show phpgt/database on its own. In WebEngine the same query and migration approach is used, but the framework constructs the surrounding application pieces for us.

Clone this wiki locally