Lab 15: Capstone — Production Platform

Time: 90 minutes | Level: Architect | Docker: docker run -it --rm php:8.3-cli bash

Overview

This capstone integrates all 14 previous labs into a cohesive production PHP platform. You'll build a complete system with: Fiber-based async scheduling, Event Sourcing, Circuit Breaker, libsodium request signing, OpenTelemetry tracing, a custom stream wrapper for config, a Reflection-based DI container, and full PHPUnit 10 test coverage — all verified end-to-end in Docker.


Architecture

┌─────────────────────────────────────────────────────────────┐
│                  Production PHP Platform                      │
├──────────────┬──────────────┬──────────────┬────────────────┤
│  Fiber       │  Event       │  Resilience  │  Observability │
│  Scheduler   │  Sourcing    │  Layer       │  Layer         │
│  (5 tasks)   │  (SQLite)    │  CB+Retry    │  OTel Spans    │
├──────────────┼──────────────┼──────────────┼────────────────┤
│  DI          │  Config      │  Security    │  PHPUnit 10    │
│  Container   │  Stream      │  Ed25519     │  7 Test Cases  │
│  (Reflect.)  │  Wrapper     │  Sodium      │                │
└──────────────┴──────────────┴──────────────┴────────────────┘

Step 1: Setup & Dependencies


Step 2: Core Infrastructure — DI Container


Step 3: Event Sourcing Core


Step 4: Resilience Layer — Circuit Breaker + Retry


Step 5: Security — Ed25519 Request Signing


Step 6: Config Stream Wrapper


Step 7: Fiber Scheduler + OTel Tracing


Step 8: Capstone — Full Integration + PHPUnit Tests

Complete Platform (single-file demo):

📸 Verified Output:


PHPUnit 10 Test Suite

📸 Verified PHPUnit Output:


Docker Run Commands


Summary

Component
Lab Reference
Implementation
Status

DI Container

Lab 07

ReflectionClass autowiring

Config Stream

Lab 05

cfg:// stream wrapper

Event Sourcing

Lab 10

SQLite EventStore + projections

Circuit Breaker

Lab 11

Closed/Open/HalfOpen FSM

Retry Decorator

Lab 11

Exponential backoff

Ed25519 Signing

Lab 08

libsodium request signing

OTel Tracing

Lab 13

InMemoryExporter + spans

Fiber Scheduler

Lab 03

5-task round-robin

PHPUnit Tests

7 tests, 12 assertions

Total LOC

~800 lines

Last updated