How silexphp/silex works
Main Components Structure
a) Application Core Layer
• CallbackResolver and ServiceControllerResolver as core components
• Controller and ControllerCollection components
b) Provider System Layer
• Service providers (src/Silex/Provider/*.php)
• How providers implement the BootableProviderInterface
• Categorize providers into main groups:
• Web Services (Twig, Asset, HttpCache)
• Security (CSRF, Security, RememberMe)
• Database (Doctrine)
• Infrastructure (Session, Monolog, SwiftMailer)
c) Event System Layer
• EventListeners (src/Silex/EventListener/*)
• Event dispatch flow
• With Symfony's EventDispatcher
Key Relationships to Highlight
• Application → ServiceProviders (registration flow)
• Application → EventListeners (event handling)
• Controllers → Application (routing and execution)
• Provider → Services (service registration)
Detailed Component Breakdown
Core Application:
[Application]
• ↓
[Provider System] ← [API Interfaces]
• ↓
[Service Container]
• ↓
[Routing System]
Provider Architecture:
[BootableProviderInterface]
• ↓
[Service Providers]
• → FormServiceProvider
• → TwigServiceProvider
• → DoctrineServiceProvider
• → Other Providers...
Additional Notes
• Keep the HTTP request/response flow visible
• Service container integration
• Extension points
• Deprecated components (as Silex is in maintenance mode)