happyr / slugify-bundle
一个用于生成瑞典文文本短语的Symfony2 Bundle
1.0.1
2014-05-08 13:05 UTC
Requires
- php: >=5.3.2
- jbroadway/urlify: 1.0.*
- symfony/framework-bundle: 2.*
Requires (Dev)
This package is auto-updated.
Last update: 2024-08-25 06:38:29 UTC
README
此Bundle提供了将URLify库集成到Symfony2中的功能。提供slugify服务及Twig过滤器。此Bundle是ZenstruckSlugifyBundle的修改版。ZenstruckSlugifyBundle使用Slugify库。
安装
-
使用composer安装
php composer.phar require happyr/slugify-bundle
-
启用Bundle
// app/AppKernel.php public function registerBundles() { $bundles = array( // ... new HappyR\SlugifyBundle\HappyRSlugifyBundle(), ); }
使用服务
$slugifier = $this->container->get('happyr.slugify.slugifier'); $text = $slugifier->slugify('Hello World!'); echo $text; //prints "hello-world"
使用Twig过滤器
{{ 'Hello World!'|slugify }} {# hello-world #}
完整默认配置
happy_r_slugify: twig: false #set to true to enable twig filter