Skip to content

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 classes
  • Domain/ - Domain layer interfaces
  • Plugin/ - Port & Adapter implementations
  • Presentation/ - Presentation layer interfaces

Application Code (app/)

Application modules follow Clean Architecture layers. The demo application (app/demo/) includes:

  • Homepage/ - Direct Mode example
  • Library/ - CQRS example with book management
  • Loan/ - Business workflow example
  • User/ - Authentication example

Module Structure

Each module contains:

  • Application/ - Commands, Queries, Handlers, Controllers
  • Domain/ - Entities, Value Objects, Events, Repository interfaces
  • Infrastructure/ - Repository implementations per database
  • Presentation/ - Presenters, ViewModels

Configuration (config/)

Configuration files use PHP arrays for type safety:

  • bootstrap.php - Application bootstrap
  • container.php - Dependency injection
  • routes.php - HTTP routing
  • events.php - Event subscriptions
  • permissions.php - RBAC permissions

Tests (tests/)

Tests are organized by type:

  • Phexium/Unit/ - Framework unit tests
  • Phexium/Integration/ - Framework integration tests
  • AppDemo/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