winglian/middleware-adapter

用于Laravel的HttpKernelInterface中间件适配器

dev-master 2015-02-19 19:36 UTC

This package is not auto-updated.

Last update: 2024-09-14 16:39:52 UTC


README

轻松重用Laravel 4和Symfony中间件在Laravel中。

如何使用

还可以查看src中的示例HttpCacheMiddlewareAdapter

class YourMiddleware extends \Winglian\MiddlewareAdapter\AbstractMiddlewareAdapter {

    protected $adaptedClass = '\Namespace\Prefix\YourHttpKernelInterfaceMiddleware';

    protected function getClassAdapterInstance(HttpKernelInterface $app)
    {
        /**
         * You can optionally change this logic if you need to resolve your adapter from the IoC
         * or pass in other options to the class.
         */
        return parent::getClassAdapterInstance($app);
    }
}