This example demonstrates clean architecture with separation between Domain and Infrastructure layers, using AbstractRepository and PHP 8 attributes.
- Pure domain entities (no framework dependencies)
- Table definitions using PHP 8 attributes (
#[Table],#[Column]) - Repository extending
AbstractRepositoryfor data access - Building tables with
AttributeTableBuilder
example.php- Main example codeDomain/User.php- Pure domain entityInfrastructure/Schema/UserTable.php- Table definition with attributesInfrastructure/Repository/UserRepository.php- Repository using AbstractRepository
php example.phpThe example demonstrates how domain entities remain framework-agnostic while infrastructure handles database operations using attributes and AbstractRepository.
- 10-attribute-based-tables - More on PHP 8 attributes
- 11-repository-pattern - Repository basics
- 04-entity-mapping - Entity class concepts