Create URL Slugs From UTF-8 Strings
- Trim Whitespace
- Lowercase (if possible)
- Replace (space) with
-
(dash) - Remove
.
,(
, and)
- Remove any duplicate
-
(dashes) - Trim any
-
(dashes) from the beginning or end
$slugger = new \GeoSocio\Slugger\Slugger();
echo $slugger->slug('St. Petersburg');
// st-petersburg
See more examples in tests/SluggerTest.php