simon-barton/seo-url
Composer 安装命令:
composer require simon-barton/seo-url
包简介
Module converts any string to valid URL
README 文档
README
Simple ZF2 SEO Url generator. Module converts strings to valid Urls. For example:
I'm starting a new project – which version of Zend Framework should I use? will be converted to
im-starting-a-new-project-which-version-of-zend-framework-should-i-use. SEO Url Module works also with non latin characters.
For string convertation I'm using part of CodeIgniter's helper url_title().
Installation
For the installation uses composer composer. Add this project in your composer.json:
"require": {
"cyrkulewski/seo-url": "dev-master"
}
Post Installation
Configuration:
- Add the module of
config/application.config.phpunder the arraymodules, insertSeoUrl. - Copy a file named
seourl.global.php.disttoconfig/autoload/and change name toseourl.global.php. - Modify config to fit your expectations.
Examples
Default use of SEO Url
$slug = $this->getServiceLocator()->get('SeoUrl\Slug'); echo $slug->create("I'm starting a new project – which version of Zend Framework should I use?");
Advanced use of SEO Url
By default SEO Url use parameters defined in config/autoload/seourl.global.php. But one might need to use different setup in different places around the code. In this case one can overwrite default confid parameters.
$slug = $this->getServiceLocator()->get('SeoUrl\Slug'); $slug->setMinLength(10); $slug->setMaxLength(100); $slug->setSeparator('_'); $slug->setStringEncoding('UTF-16'); $slug->setForeignChars(array('/я/' => 'ja')); echo $slug->create("I'm starting a new project – which version of Zend Framework should I use?");
Contributors
Aleksander Cyrkulewski - cyrkulewski@gmail.com
统计信息
- 总下载量: 135
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2014-12-28