ezsystems/templated-uri-bundle
最新稳定版本:3.4.0
Composer 安装命令:
composer require ezsystems/templated-uri-bundle
包简介
Symfony2 Bundle that provides a RFC-6570 compatible router and URL Generator.
README 文档
README
Symfony Bundle for the https://github.com/hautelook/TemplatedUriRouter
library.
hautelook/TemplatedUriRouter provides a RFC-6570 compatible
Symfony router and URL Generator.
Installation
Assuming you have installed composer, run the following command:
$ composer require hautelook/templated-uri-bundle
Now add the bundle to your Kernel:
<?php // app/AppKernel.php public function registerBundles() { $bundles = array( // ... new Hautelook\TemplatedUriBundle\HautelookTemplatedUriBundle(), // ... ); }
If you are using Symfony Flex, this bundle is added automatically to your bundles.php file.
Usage
The bundle exposes a router service (hautelook.router.template) that will generate RFC-6570 compliant URLs.
Here is a sample on how you could use it:
$templateLink = $container->get('hautelook.router.template')->generate('hautelook_demo_route', array( 'page' => '{page}', 'sort' => array('{sort}'), 'filter' => array('{filter}'), ) );
This will produce a link similar to:
/demo?{&page}{&sort*}{&filter*}
统计信息
- 总下载量: 12.1k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-03-16