Configuration¶
Initialize project files:
vendor/bin/schemage --init
This creates the default configuration and schema structure.
Example configuration¶
<?php
return [
'schema' => 'database/schema.php',
'bootstrap' => 'bootstrap.php',
'database' => [
'driver' => 'mysql',
'host' => $_ENV['DB_HOST'] ?? '127.0.0.1',
'port' => $_ENV['DB_PORT'] ?? 3306,
'database' => $_ENV['DB_NAME'] ?? 'app',
'username' => $_ENV['DB_USER'] ?? 'root',
'password' => $_ENV['DB_PASS'] ?? '',
'charset' => $_ENV['DB_CHARSET'] ?? 'utf8mb4',
],
'generator' => [
'models' => [
'enabled' => false,
'namespace' => 'App\\Models',
'path' => 'app/Models',
'extends' => null,
],
],
'snapshots' => [
'path' => 'storage/schema.snapshot.json',
],
];
For SQLite, the database configuration should identify the sqlite driver and the configured database file according to the connection factory used by the project.
Bootstrap file¶
The optional bootstrap file is loaded before schema operations run. It can be used to:
- load
.envvalues - bootstrap a framework
- include helper functions
- configure runtime behavior