Slug

PHP slug creation

  • 所有者: fabeat/Slug
  • 平台:
  • 许可证: MIT License
  • 分类:
  • 主题:
  • 喜欢:
    0
      比较:

Github星跟踪图

Slug

A little PHP project to simplify slug generation for URLs in web-projects.

Usage

Basic usage

require_once '/path/to/Slug.class.php';
$slug_string = (string) new Slug('Hello World!');
echo $slug_string;

Output: hallo-welt

Basic usage (with max-length)

echo new Slug('A PHP project to simplify slug generation.', array('max_length' => 20));

Output: a-php-project-to

You might notice that the slug is automatically shortened so that there are no cutted words.
This only applies if the cutted word part is smaller than half the generated slug.

see test/SlugTest.php for more examples.

If you want to run the tests, install PHPUnit from http://www.phpunit.de/ and run

phpunit SlugTest

主要指标

概览
名称与所有者fabeat/Slug
主编程语言PHP
编程语言PHP (语言数: 1)
平台
许可证MIT License
所有者活动
创建于2010-08-17 15:04:27
推送于2010-08-23 12:57:58
最后一次提交2010-08-23 20:51:33
发布数0
用户参与
星数7
关注者数1
派生数1
提交数3
已启用问题?
问题数0
打开的问题数0
拉请求数0
打开的拉请求数0
关闭的拉请求数0
项目设置
已启用Wiki?
已存档?
是复刻?
已锁定?
是镜像?
是私有?