Skip to content

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 example
  • app/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 classes
  • Domain/ - Domain layer interfaces
  • Plugin/ - Port & Adapter implementations
  • Presentation/ - 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 example
  • Library/ - CQRS example with book management
  • Loan/ - Business workflow example
  • User/ - Authentication example
  • Shared/ - Cross-module shared code

The starter application includes only Homepage/.

Module Structure

Each module contains:

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

Tests (tests/)

Tests are organized by component and type:

  • Phexium/Component/ - Framework tests (unit + integration, distinguished via pest()->group())
  • AppDemo/Component/ - Demo application tests (unit + integration)
  • AppDemo/Acceptance/ - Behat BDD tests for demo application
  • AppStarter/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 own config/, database/, and src/
  • Configuration is explicit in PHP files
  • Tests mirror source structure

See Also