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?
已存檔?
是復刻?
已鎖定?
是鏡像?
是私有?