mini\db() Function

Documentation

Get the database service instance

Returns a lazy-loaded DatabaseInterface for executing queries. Works out of the box with SQLite (_database.sqlite3 in project root).

Configure via environment variables:

  • DATABASE_URL: mysql://user:pass@host/dbname, postgresql://..., sqlite:///path
  • MINI_DATABASE_URL: Same format, takes precedence over DATABASE_URL

Signature

function db(): mini\Database\DatabaseInterface

Returns

mini\Database\DatabaseInterface

Source

src/Database/functions.php:160-162