Download the PHP package eril/tbl-class without Composer
On this page you can find all versions of the php package eril/tbl-class. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download eril/tbl-class
More information about eril/tbl-class
Files in eril/tbl-class
Package tbl-class
Short Description CLI tool that Generates stable PHP constants from your database schema to improve IDE autocomplete and avoid SQL typos.
License MIT
Homepage https://github.com/erilshackle/tbl-class-php
Informations about the package tbl-class
Tbl::class
Type-safe database schema constants para PHP
tbl-class generates immutable PHP entry-point classes that map your database schema
(tables, columns and relations) into compile-safe constants.
It provides a stable abstraction layer between your database and your application code, eliminating fragile string literals and runtime schema assumptions.
Why tbl-class?
Database-driven PHP applications commonly rely on raw strings:
This approach is fragile:
- typos are silent
- refactors are risky
- schema changes break code at runtime
- no compile-time guarantees
tbl-class replaces string-based access with generated constants derived directly
from the database schema:
Your application code becomes schema-aware, explicit and refactor-safe.
Installation
Usage
First run
On first execution, a configuration file is generated:
Edit the file, configure your database connection, then run the command again.
Generate schema constants
This command:
- connects to the database
- introspects the schema
- generates PHP constants according to your configuration
Check for schema changes (CI-friendly)
This mode:
- does not generate files
- compares the current database schema with the last generated version
- exits with a non-zero status code if changes are detected
Designed for CI pipelines and deployment safety checks.
It's not meant to be checked overtime, but only
Configuration
All configuration lives in tblclass.yaml.
A clean template is auto-generated on first run:
📘 Full configuration reference: https://github.com/erilshackle/tbl-class-php/wiki/config
Generated Output
Depending on the enabled generators, tbl-class produces PHP classes containing:
- table name constants
- column name constants
- foreign key references
- JOIN expressions derived from relations
Example usage:
All output is deterministic, static, and runtime-free.
Autoloading
After generation, add one of the following to your composer.json.
PSR-4
Files
Then run:
Documentation
All advanced topics, design decisions and future extensions are documented in the Wiki:
📚 Wiki
What tbl-class is not
- ❌ Not an ORM
- ❌ Not a query builder
- ❌ Not a migration tool
- ❌ Not a runtime schema inspector
It is a compile-time schema contract for PHP applications.
License
MIT © 2026 Eril TS Carvalho