URLify PHP port for Laravel4
A PHP port of URLify.js
from the Django project. Handles symbols from Latin languages, Czech, Greek, Latvian,
Lithuanian, Polish, Romanian, Russian, Turkish and Ukrainian. Symbols it cannot
transliterate it will simply omit., (*1)
Install:
-
Add "require": { "j0an/urlify": "dev-master" }
to composer.json, (*2)
-
Run composer update
, (*3)
-
Add to app/config
at the bottom of Providers:, (*4)
'j0an\Urlify\UrlifyServiceProvider'
Usage:
To generate slugs for URLs:, (*5)
To simply transliterate characters:, (*6)
To extend the character list:, (*7)
'?', '®' => '(r)', '¼' => '1/4',
'¼' => '1/2', '¾' => '3/4', '¶' => 'P'
));
echo j0an\Urlify::downcode ('¿ ® ¼ ¼ ¾ ¶');
// "? (r) 1/2 1/2 3/4 P"
?>
To extend the list of words to remove:, (*8)
To priorize a certain language map:, (*9)
Please note that the "ü" is transliterated to "ue" in the first case, whereas it results in a simple "u" in the latter., (*10)