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 the order they are supplied.
Loads route definitions from a PHP file returning a router configurator callback.
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.
Returns the framework dependency injection container.
Details
__construct
__construct(ContainerInterface $container, ApplicationContext $context)
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(ServiceProviderInterface ...$providers)
Registers one or more service providers in the order they are supplied.
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.
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, and the pipeline terminates in the dispatch request handler.