# Pure PHP + PSR sample skeleton Minimal **folder skeleton** for Modular Hexagonal Domain-Driven Design without a full framework. Illustrative modules: `Ordering`, `Warehouse`. | | | | --- | --- | | **Aligned Core** | `1.0.0-draft` | | **Purpose** | Show portable layout + PSR-friendly autoload — not a runnable shop | | **Host** | None (composition root is plain PHP) | ## Layout ```text samples/pure-php-psr/ ├── composer.json # PSR-4 autoload sketch ├── public/index.php # HTTP front controller (thin) ├── src/ │ ├── Shared/ │ │ ├── Domain/Ports/ │ │ └── Infrastructure/ │ ├── Ordering/ │ │ ├── Application/ │ │ │ ├── DTO/Order/ │ │ │ ├── Providers/ │ │ │ └── UseCases/Order/ │ │ ├── Domain/ │ │ │ ├── Entities/ │ │ │ ├── Events/ │ │ │ └── Ports/ │ │ │ ├── Order/ │ │ │ ├── Acl/ │ │ │ └── Module/ │ │ ├── Infrastructure/ │ │ │ ├── ExternalServices/ │ │ │ └── Persistence/ │ │ └── UI/Http/ │ └── Warehouse/ │ ├── Application/ │ ├── Domain/ │ ├── Infrastructure/ │ └── UI/ └── README.md ``` ## PSR notes - **PSR-4** namespaces under `src/` (see `composer.json`). - Prefer **PSR-11** container in the composition root when you add one. - Prefer **PSR-3** logger and **PSR-14** / queue equivalent behind Shared ports (`EventDispatcherInterface`, …). - Domain stays free of PSR implementations — only ports. ## Replaceability Ordering Application/Domain must not import Warehouse Application/Domain. Use: - Sync: `WarehouseAvailabilityPortInterface` + ACL adapter - Async: `OrderFulfilled` → Warehouse Infrastructure listener → inbound Use Case ## Next steps for implementers 1. Add real Entities / Use Cases for place-order + fulfill. 2. Bind ports in `Ordering/Application/Providers` (or a single `bootstrap.php`). 3. Swap in-memory persistence for PDO / Doctrine later — Domain unchanged.