2017 © Pedro Peláez
 

library slugutf8

generate UTF-8 URL slug

image

rny/slugutf8

generate UTF-8 URL slug

  • Friday, October 28, 2016
  • by rny
  • Repository
  • 1 Watchers
  • 0 Stars
  • 60 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 0 % Grown

The README.md

SlugUtf8

Build Status, (*1)

SlugUtf8 is a simple library to generate friendly URL slug from a UTF-8 string. It keeps most of the UTF-8 charaters unchanged to better support Chinese/Japanese. SlugUtf8 is modified from https://gist.github.com/sgmurphy/3098978, (*2)

Highlights

  • Removes all special characters but keeps UTF-8 charaters unchanged.
  • Support Chinese / Japanese.
  • Dot between numbers is unchanged, e.g. 3.8.5
  • Composer ready, PSR-4 compatible.
  • PHPUnit tested.

Install

Install SlugUtf8 using Composer., (*3)

$ composer require rny/slugutf8

Usage

use Rny\SlugUtf8\SlugUtf8;

$slug = SlugUtf8::SlugUtf8($str);
$slug = \Rny\SlugUtf8\SlugUtf8::SlugUtf8($str);
$options = array(
    'delimiter' => '-',
    'limit' => null,
    'lowercase' => true,
    'replacements' => array(),
    'transliterate' => false,
    'strip_non_utf8' => false,
);
$slug = \Rny\SlugUtf8\SlugUtf8::SlugUtf8($str, $options);

Testing

$ composer test

The Versions

28/10 2016

dev-master

9999999-dev

generate UTF-8 URL slug

  Sources   Download

MIT

The Development Requires

by Avatar rny

slug

28/10 2016

1.0.1

1.0.1.0

generate UTF-8 URL slug

  Sources   Download

MIT

The Development Requires

by Avatar rny

slug

28/10 2016

1.0.0

1.0.0.0

generate UTF-8 URL slug

  Sources   Download

MIT

The Development Requires

by Avatar rny

slug

28/10 2016

0.9.0

0.9.0.0

generate UTF-8 URL slug

  Sources   Download

MIT

The Development Requires

by Avatar rny

slug