stack / lazy-http-kernel
HttpKernelInterface lazy proxy.
Installs: 28 318
Dependents: 0
Suggesters: 1
Security: 0
Stars: 31
Watchers: 9
Forks: 10
Open Issues: 4
Requires
- php: >=5.4.0
- symfony/http-foundation: ~2.1
- symfony/http-kernel: ~2.1
Requires (Dev)
- stack/callable-http-kernel: ~1.0@dev
- stack/url-map: ~1.0@dev
This package is not auto-updated.
Last update: 2024-07-29 13:00:58 UTC
README
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
:
use Stack\LazyHttpKernel; $app = new LazyHttpKernel(function () { return require __DIR__.'/../app.php'; });
As a shortcut, you can use the Stack\lazy
function:
use Stack; $app = Stack\lazy(function () { return require __DIR__.'/../app.php'; });
When combined with the UrlMap middleware it makes a bit more sense:
use Stack; use Stack\UrlMap; $app = ...; $app = new UrlMap($app, [ '/foo' => Stack\lazy(function () { return require __DIR__.'/../app.php'; }) ]);