Demo Application Overview
Phexium ships with a demo application (app/demo/) that demonstrates framework capabilities through a library management system. This application serves as a reference implementation, not as boilerplate to extend.
Purpose
The demo application showcases:
- Clean Architecture layer separation
- Both architectural modes (Bus Mode and Direct Mode)
- Domain-Driven Design patterns
- Event-driven communication
- RBAC-based authorization
Modules
| Module | Purpose | Architecture Mode |
|---|---|---|
| Homepage | Welcome page | Direct Mode (UseCase) |
| Library | Book catalog management | Bus Mode (CQRS) |
| Loan | Borrowing and returns | Bus Mode (CQRS) |
| User | Authentication | Bus Mode (CQRS) |
Plus a Shared module containing cross-cutting concerns.
Configuration
Demo-specific configuration resides in app/demo/config/:
routes.php- HTTP routingevents.php- Event subscriptionspermissions.php- RBAC permissionscontainer.php- Dependency injectionbootstrap.php- Application bootstrap
Access
The demo runs at http://localhost:8080 with two user roles:
- Admin (
admin@phexium.com) - Full access - User - Can view own loans and borrow books
API Endpoints
GET /api/books- List all booksPOST /api/books- Create a bookGET /api/books/{id}- Get book details
Demo vs Starter Application
Phexium ships two applications with different purposes. The demo (app/demo/) is a feature-rich reference implementation. The starter (app/starter/) is a minimal template for new projects.
| Aspect | Demo | Starter |
|---|---|---|
| Modules | Homepage, Library, Loan, User, Shared | Homepage only |
| Controller base class | AbstractHttpController (app-specific, provides user context) | AbstractController (framework generic) |
| User context | UserContextMiddleware injects authentication state into requests | No user context middleware |
| Session services | SessionServiceInterface with authentication methods | Framework SessionInterface only |
| RBAC permissions | 6 permissions across 2 roles | None |
| Events | 7 event-listener mappings | None |
| Query caching | CachedQueryBus with Redis | SyncQueryBus |
| Clock | MonotonicClock (unique timestamps) | SystemClock |
These differences are intentional: the starter provides the minimum viable structure to begin a new project, while the demo showcases the full framework capabilities.
See Also
- Clean Architecture - Layer separation demonstrated
- Bus Mode - Library/Loan/User modules
- Direct Mode - Homepage module
- Domain-Driven Design - DDD patterns showcased
- Event-Driven Architecture - Event-driven communication
- RBAC Permissions - Authorization example