Skip to content

CLI reference ​

Run the executable from the directory containing tblclass.yaml:

bash
php vendor/bin/tbl-class --help

Commands ​

CommandBehavior
initCreate a configuration template; refuse to overwrite an existing file
generateConnect to the database and generate the class
checkCompare the current schema and settings with saved metadata
check --diffAlso print detected differences
independence <directory>Replace resolvable references with literal values
--helpShow usage
--versionShow the version

With no arguments, the CLI lists commands. Legacy --generate and --check flags remain available; --check --diff is supported.

Options ​

OptionScope
--diffcheck only
--dry-runPreview independence without writing
--generated <file>Select the PHP class read by independence

Invalid option combinations return 2. Only one command can be specified per invocation.

Exit codes ​

CodeMeaning
0Success; no drift or unresolved references for the selected operation
1Operational error, schema/configuration drift, or unresolved independence references
2Invalid CLI arguments, initial generation required, or existing config during init

Use the accompanying message to distinguish drift from operational failures.

Generation failures ​

Generation rejects an empty schema, invalid namespaces, duplicate constant names, and invalid generated PHP. Output is written to a temporary file in the destination directory and linted before replacing the previous file.

See check & diff and independence for their comparison and conversion boundaries.

Released under the MIT License.