stack / lazy-http-kernel
此包已被弃用且不再维护。未建议替代包。
HttpKernelInterface 懒代理。
v1.0.0
2013-12-04 11:21 UTC
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 懒代理。
这在与UrlMap之类的工具结合使用时非常有用,其中子内核只有在条件满足时才会创建。
示例
基本示例,假设 app.php
返回一个 HttpKernelInterface
实例
use Stack\LazyHttpKernel; $app = new LazyHttpKernel(function () { return require __DIR__.'/../app.php'; });
作为快捷方式,可以使用 Stack\lazy
函数
use Stack; $app = Stack\lazy(function () { return require __DIR__.'/../app.php'; });
与UrlMap中间件结合使用时,更有意义
use Stack; use Stack\UrlMap; $app = ...; $app = new UrlMap($app, [ '/foo' => Stack\lazy(function () { return require __DIR__.'/../app.php'; }) ]);