Project Structure
Phexium follows a clear directory structure separating framework code, application code, configuration, and tests.
Top-Level Directories
| Directory | Purpose |
|---|---|
src/ | Framework core (namespace: Phexium) |
app/ | Application code (namespace: App) |
config/ | Configuration files |
public/ | Web entry point |
tests/ | Automated tests |
database/ | Database schemas |
Framework Core (src/)
This directory contains Phexium framework code, fully modifiable after installation:
Application/- Command/Query/Event base classesDomain/- Domain layer interfacesPlugin/- Port & Adapter implementationsPresentation/- Presentation layer interfaces
Application Code (app/)
Application modules follow Clean Architecture layers. The demo application (app/demo/) includes:
Homepage/- Direct Mode exampleLibrary/- CQRS example with book managementLoan/- Business workflow exampleUser/- Authentication example
Module Structure
Each module contains:
Application/- Commands, Queries, Handlers, ControllersDomain/- Entities, Value Objects, Events, Repository interfacesInfrastructure/- Repository implementations per databasePresentation/- Presenters, ViewModels
Configuration (config/)
Configuration files use PHP arrays for type safety:
bootstrap.php- Application bootstrapcontainer.php- Dependency injectionroutes.php- HTTP routingevents.php- Event subscriptionspermissions.php- RBAC permissions
Tests (tests/)
Tests are organized by type:
Phexium/Unit/- Framework unit testsPhexium/Integration/- Framework integration testsAppDemo/Acceptance/- Behat BDD tests for demo application
Key Points
- Framework code (
src/) is owned and modifiable - Application code follows Clean Architecture with strict layer separation
- Configuration is explicit in PHP files
- Tests mirror source structure
See Also
- Clean Architecture - Layer structure rationale
- Port & Adapter Pattern - Plugin directory organization