PHP Classes

PHP Slug Generator: Create a slug text for a URL from another text

Recommend this page to a friend!
     
  Info   Example   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 237 All time: 8,067 This week: 673Up
Version License PHP version Categories
php-slugit 0.5MIT/X Consortium ...5PHP 5, Text processing, SEO
Description 

Author

This class can create a slug text for a URL from another text.

It takes a given text string and processes it to generate a slug text only with plain ASCII text characters that can be used in URLs that are readable and friendly for the users.

The class replaces all spaces by dashes, and transliterate letters with accents and cedillas to the corresponding characters in ASCII.

Picture of afshin akhgar
  Performance   Level  
Name: afshin akhgar <contact>
Classes: 3 packages by
Country: Iran Iran
Age: 39
All time rank: 251142 in Iran Iran
Week rank: 215 Up2 in Iran Iran Up
Innovation award
Innovation award
Nominee: 1x

Example

<?php
require __DIR__ . '/vendor/autoload.php';
use
PhpSlugger\PhpSlugger;

$phpSlugger = new PhpSlugger();
echo
$phpSlugger->slugit('? ? $ Þ ? ? Sad asd as dfasif hasoif h');


Details

php-slugit

create url slug from a text and replace special character

Install

composer install
Direct install from composer
composer require afshinpersian/phpslugger

Include it via Composer Autoloader

require __DIR__ . '/vendor/autoload.php';
use PhpSlugger\PhpSlugger;

$phpSlugger = new PhpSlugger();
echo $phpSlugger->slugit('? ? $ Þ ?  I am A web Developer'); // delta-euro-dollor-l-i-am-a-web-developer

support


  Files folder image Files (5)  
File Role Description
Files folder imagesrc (1 file)
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file index.php Example Example script
Accessible without login Plain text file LICENSE Lic. License text
Accessible without login Plain text file README.md Doc. Documentation

  Files folder image Files (5)  /  src  
File Role Description
  Plain text file PhpSlugger.php Class Class source

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 100%
Total:237
This week:0
All time:8,067
This week:673Up