Skip to content
This repository was archived by the owner on Jul 29, 2024. It is now read-only.

Repository files navigation

Stack/LazyHttpKernel

HttpKernelInterface lazy proxy.

This is useful in combination with something like UrlMap, where sub-kernels are only created conditionally.

Example

The basic example, assumes that app.php returns an instance of HttpKernelInterface:

useStack\LazyHttpKernel;
$app = newLazyHttpKernel(function () {
returnrequire__DIR__.'/../app.php';
});

As a shortcut, you can use the Stack\lazy function:

useStack;
$app = Stack\lazy(function () {
returnrequire__DIR__.'/../app.php';
});

When combined with the UrlMap middleware it makes a bit more sense:

useStack;
useStack\UrlMap;
$app = ...;
$app = newUrlMap($app, [
'/foo' => Stack\lazy(function () {
returnrequire__DIR__.'/../app.php';
})
]);

About

HttpKernelInterface lazy proxy.

Resources

Stars

31 stars

Watchers

4 watching

Forks

Releases

Packages

Contributors

Languages