Framework
final class Framework (View source)
Main bootstrap and runtime facade for the Lemonade Framework HTTP application layer.
The facade coordinates service provider registration, configuration definitions, localized route setup, middleware configuration, and execution of the PSR-15 request pipeline. It operates on top of the supplied dependency injection container and application context.
Methods
Creates a framework runtime bound to the provided container and application context.
Returns the application context used during framework bootstrap.
Registers one or more service providers in stable dependency order.
Compiles definitions and invokes bootable providers in registration order.
Loads route definitions from a PHP file returning a router configurator callback.
Finalizes application routing after providers and application composition routes.
Registers configuration definitions and merges their serialized data into runtime config state.
Loads a configuration definition from file through the config file loader.
Configures the framework middleware stack.
Runs an HTTP request through the configured middleware pipeline.
Runs an HTTP request in an already-active request scope.
Returns the framework dependency injection container.
Details
__construct
__construct(ContainerInterface $container, ApplicationContext $context, HttpDiagnosticsObserverFactoryInterface|null $diagnostics = null)
Creates a framework runtime bound to the provided container and application context.
The constructor initializes the framework router and registers the core framework services required for configuration loading and request handling.
context
ApplicationContext
context()
Returns the application context used during framework bootstrap.
register
Framework
register(object ...$providers)
Registers one or more service providers in stable dependency order.
Providers without explicit dependencies preserve their supplied order.
registerPlan
Framework
registerPlan(ProviderLifecyclePlan $plan)
| internal | Executes one globally validated bootstrap provider plan. |
No description
bootProviders
void
bootProviders()
Compiles definitions and invokes bootable providers in registration order.
routes
Framework
routes(callable $builder)
Configures application routes through the framework router.
Localized route settings are applied before the callback is invoked.
routesFromFile
Framework
routesFromFile(string $file)
Loads route definitions from a PHP file returning a router configurator callback.
Localized route settings are applied before the loaded callback is invoked.
finalizeRoutes
void
finalizeRoutes()
Finalizes application routing after providers and application composition routes.
The kernel owns this lifecycle boundary. Providers only register typed route registrars; application routing files only register application routes.
config
Framework
config(ConfigDefinitionInterface ...$definitions)
Registers configuration definitions and merges their serialized data into runtime config state.
Definitions are processed in the order they are supplied.
configFromFile
Framework
configFromFile(string $file, string|null $rootKey = null)
Loads a configuration definition from file through the config file loader.
When provided, the root key selects the root section to load from the file.
middleware
Framework
middleware(callable $configure)
Configures the framework middleware stack.
If the middleware stack is already available in the container, the callback is applied immediately. Otherwise, it is deferred until just before the request pipeline is executed.
run
ResponseInterface
run(ServerRequestInterface|null $request = null)
Runs an HTTP request through the configured middleware pipeline.
When no request is supplied, a server request is created from global PHP state through the server request factory. Any deferred middleware configuration is applied before middleware is resolved. This convenience entrypoint owns its HTTP measurement boundary and request scope; Kernel callers pass their already-active scope to {\Lemonade\Framework\Core\runInScope()} instead.
runInScope
ResponseInterface
runInScope(ScopedContainerInterface $scope, ServerRequestInterface $request)
Runs an HTTP request in an already-active request scope.
The scope must be {\Lemonade\Framework\Container\ScopeKind::Request}, must hold a scope-local {\Psr\Http\Message\ServerRequestInterface} binding, and that binding must be the same object as the request argument. The method resolves and locally binds the trusted request context when the caller has not already done so. Dispatch does not require diagnostics.