description: Phexium directory layout: framework core in src/, application modules in app/, and test organization.
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 |
public/ | Root landing page |
database/ | Shared database scripts |
tests/ | Automated tests |
The app/ directory contains two self-contained applications:
app/demo/- Demo application (namespace:AppDemo) with full library management exampleapp/starter/- Starter application (namespace:AppStarter) as minimal template for new projects
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 Structure (app/{app}/)
Each application is self-contained with its own configuration, database schemas, and modules:
| Directory | Purpose |
|---|---|
app/{app}/config/ | Configuration (bootstrap, container, routes, events, permissions) |
app/{app}/database/ | SQL schemas and fixtures |
app/{app}/public/ | Web entry point (index.php) |
app/{app}/src/ | Application modules |
app/{app}/.env | Environment configuration |
Modules (app/{app}/src/)
The demo application includes the following modules:
Homepage/- Direct Mode exampleLibrary/- CQRS example with book managementLoan/- Business workflow exampleUser/- Authentication exampleShared/- Cross-module shared code
The starter application includes only Homepage/.
Module Structure
Each module contains:
Application/- Commands, Queries, Handlers, EventListenersDomain/- Entities, Value Objects, Events, Repository interfacesInfrastructure/- Repository implementations per databasePresentation/- Controllers, Presenters, ViewModels
Tests (tests/)
Tests are organized by component and type:
Phexium/Component/- Framework tests (unit + integration, distinguished viapest()->group())AppDemo/Component/- Demo application tests (unit + integration)AppDemo/Acceptance/- Behat BDD tests for demo applicationAppStarter/Acceptance/- Behat BDD tests for starter application
Key Points
- Framework code (
src/) is owned and modifiable - Each application under
app/is self-contained with its ownconfig/,database/, andsrc/ - Configuration is explicit in PHP files
- Tests mirror source structure
See Also
- Clean Architecture - Layer structure rationale
- Port & Adapter Pattern - Plugin directory organization