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)    
Last Updated Ratings Unique User Downloads Download Rankings
2021-04-27 (4 months ago) RSS 2.0 feedNot enough user ratingsTotal: 99 All time: 9,519 This week: 200Up
Version License PHP version Categories
php-slugify 1.0.0MIT/X Consortium ...5PHP 5, Text processing
Description Author

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: 32 packages by
Country: Egypt Egypt
Innovation award
Innovation award
Nominee: 17x

Details

<p align="center"><a href="https://pharaonic.io" target="_blank"><img src="https://raw.githubusercontent.com/Pharaonic/logos/main/php/slugify.jpg" width="470"></a></p>

<p align="center"> <a href="https://github.com/Pharaonic/php-slugify" target="_blank"><img src="http://img.shields.io/badge/source-pharaonic/php--slugify-blue.svg?style=flat-square" alt="Source"></a> <a href="https://packagist.org/packages/pharaonic/php-slugify" target="_blank"><img src="https://img.shields.io/packagist/v/pharaonic/php-slugify?style=flat-square" alt="Packagist Version"></a> <img src="https://img.shields.io/packagist/dt/pharaonic/php-slugify?style=flat-square" alt="Packagist Downloads"> <img src="http://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square" alt="Source"> </p>

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

Install

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

$ composer require pharaonic/php-slugify

Usage

<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');

License

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 README.md 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  
 100%
Total:99
This week:0
All time:9,519
This week:200Up
User Comments (1)
Congratulations, thats a very good class ;-)
4 months ago (José Filipe Lopes Santos)
70%StarStarStarStar
 
For more information send a message to info at phpclasses dot org.