PHP Classes

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

Recommend this page to a friend!
  Info   View files Example   View files View files (5)   DownloadInstall with Composer Download .zip   Reputation   Support forum (1)   Blog (1)    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 237 This week: 1All time: 8,056 This week: 560Up
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: 38
All time rank: 250942 in Iran Iran
Week rank: 52 Up1 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  
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  /  src  
File Role Description
  Plain text file PhpSlugger.php Class Class source

 Version Control Unique User Downloads Download Rankings  
 100%
Total:237
This week:1
All time:8,056
This week:560Up