jaenmedina/slugifier 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

jaenmedina/slugifier

最新稳定版本:0.3.0

Composer 安装命令:

composer require jaenmedina/slugifier

包简介

A simple php library to generate slugs.

README 文档

README

Build Status Codacy Badge Code Climate

A simple php library to generate slugs.

Version

0.3.1

Install with composer

Add the package dependency jaenmedina/slugifier in your composer.json

{
    "require": {
        "jaenmedina/slugifier": "0.3.1"
    }
}

How to use?

Just instantiate the Slugifier class and call the slugify method. For example:

$slugifier = new Slugifier();
$slug = $slugifier->slugify("Hello, world!");
echo $slug; // prints "hello-world"

If you want to set the separator just use the setSeparator function:

$slugifier = new Slugifier();
$slugifier->setSeparator("_");
$slug = $slugifier->slugify("Hello, world!");
echo $slug; // prints "hello_world"

If you want to exclude certain words from the slug you can use the excludeWords function:

$slugifier = new Slugifier();
$slugifier->excludeWords(["world", "How", "is"]);
$slug = $slugifier->slugify("Hello, world! How is everybody?");
echo $slug; // prints "hello-everybody"

To add specific mapping rules you can use the addRule, addRules and setRules functions:

$slugifier = new Slugifier();
$slugifier->setRules(["é" => "e"]);
$slugifier->addRule("ñ", "n");
$slugifier->addRules(["ü" => "u"]);
$slug = $slugifier->slugify("Intenté Español Pingüino");
echo $slug; // prints "intente-espanol-pinguino"

License

MIT

统计信息

  • 总下载量: 30
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 2
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-04-09

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固