thewunder/croute-bundle
Composer 安装命令:
composer require thewunder/croute-bundle
包简介
Symfony Bundle for the Croute Router
README 文档
README
This package integrates the Croute Router into Symfony, and makes it available as a service.
Install using:
composer require thewunder/croute-bundle
Configure your controller namespace(s) in config/packages/croute.yaml
croute: namespaces: - App\Controller
In your Kernel.php return the CrouteKernel instead of the default symfony Router.
use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait; use Symfony\Component\HttpKernel\HttpKernelInterface; use Symfony\Component\HttpKernel\Kernel as BaseKernel; class Kernel extends BaseKernel { use MicroKernelTrait; public function getHttpKernel(): HttpKernelInterface { return $this->getContainer()->get('croute.kernel'); } }
And all controllers in the configured namespace(s) and set up for autowiring.
namespace App\Controller use Croute\Controller; use Psr\Log\LoggerInterface; use Symfony\Component\HttpFoundation\Response; class IndexController extends Controller { public function __construct(private readonly LoggerInterface $orm) { } public function indexAction(): Response { $this->logger->debug('IndexController->indexAction'); return new Response('Hello from Croute!'); } }
统计信息
- 总下载量: 7
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Unknown
- 更新时间: 2024-11-05