PHP Classes

PHP Slugify: Create a slug text from a given text string

Recommend this page to a friend!
  Info   View files Documentation   View files View files (5)   DownloadInstall with Composer Download .zip   Reputation   Support forum (2)   Blog (1)    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 107 All time: 9,679 This week: 673Up
Version License PHP version Categories
php-slugify 1.0.0MIT/X Consortium ...5PHP 5, Text processing


This class can be used to create a slug text from a given text string.

It can take a given string encoded in UTF-8 and then can replace non-ASCII characters by equivalent strings that only use ASCII text.

The class uses an internal array that is used to defined how the characters are mapped. It also provides a function that can be used to change the mappings of specific characters.

Innovation Award
PHP Programming Innovation award nominee
April 2021
Number 6
A slug is a text that is often used in URLs to make them more readable for the users.

Usually this is done by replacing any non-ASCII characters by equivalent characters that can be read by users in the way the characters should sound.

There are many solutions to create a slug text. This package provides a more flexible solution that allows developers to customize how each character is mapped to other characters in the slug text.

This solution may be better when applications need to create slug texts that need to be readable by users that only understand other languages besides English.

Manuel Lemos
Picture of Moamen Eltouny
  Performance   Level  
Name: Moamen Eltouny <contact>
Classes: 37 packages by
Country: Egypt Egypt
Age: 31
All time rank: 258326 in Egypt Egypt
Week rank: 85 Up4 in Egypt Egypt Up
Innovation award
Innovation award
Nominee: 21x


<p align="center"><a href="" target="_blank"><img src="" width="470"></a></p>

<p align="center"> <a href="" target="_blank"><img src="" alt="Source"></a> <a href="" target="_blank"><img src="" alt="Packagist Version"></a> <img src="" alt="Packagist Downloads"> <img src="" alt="Source"> </p>

<h1 align="center">Simplest Slugify for PHP.</h1>


Slugify requires the Multibyte String mbstring extension from PHP.<br> Install the latest version using Composer:

$ composer require pharaonic/php-slugify


<a name="GS"></a>

Get Slug

use Pharaonic\Slugify\Slugify;
echo Slugify::get('Moamen Eltouny');

// OR
echo slug('Moamen Eltouny');

<a name="RM"></a>

Rules Manipulation

use Pharaonic\Slugify\Slugify;
Slugify::rule('÷', 'oe');


MIT license

  Files folder image Files  
File Role Description
Files folder imagesrc (2 files)
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file LICENSE Lic. License text
Accessible without login Plain text file Doc. Documentation

  Files folder image Files  /  src  
File Role Description
  Accessible without login Plain text file Helpers.php Aux. Auxiliary script
  Plain text file Slugify.php Class Class source

 Version Control Unique User Downloads Download Rankings  
This week:0
All time:9,679
This week:673Up
User Comments (1)
Congratulations, thats a very good class ;-)
3 years ago (JosÚ Filipe Lopes Santos)