oodle / urlify
urlify - a library for creating url-safe slugs from text
Requires
- php: >=5.3.17
Requires (Dev)
- phpunit/phpunit: 3.7.*
This package is auto-updated.
Last update: 2024-10-18 16:18:18 UTC
README
Urlify is a library for creating url-safe slugs from text. It will also down-convert (Romanize) foreign ascii characters into plain ascii.
Installation:
Add this line to your composer.json "require" section:
composer.json
"require": { ... "oodle/urlify": "*"
Usage:
Urlify\Urlify::urlify($string, $separator = '-', $ampersand = null)
Examples:
use Urlify\Urlify;
echo Urlify::urlify('blah blah blah'); // Should output "blah-blah-blah"
echo Urlify::urlify('This is a sentence.'); // Should output "This-is-a-sentence"
echo Urlify::urlify('kraĆ¼t'); // Should output "kraut"
echo Urlify::urlify('what ever', '.'); // Should output "what.ever"
echo Urlify::urlify('blah&blah'); // Should output "blah-blah"
echo Urlify::urlify('blah&blah', '-', 'and'); // Should output "blah-and-blah"
Notes:
------
Please note that the string should be in ascii or iso-8859-1 in order for Romanization to work