geosocio / slugger
Creates URL Slugs from Strings
1.1.2
2018-01-26 00:51 UTC
Requires (Dev)
- phpunit/phpunit: ^6.2
- squizlabs/php_codesniffer: ^3.0
- symfony/var-dumper: ^3.3
This package is auto-updated.
Last update: 2024-10-12 01:20:40 UTC
README
Create URL Slugs From UTF-8 Strings
Rules
- Trim Whitespace
- Lowercase (if possible)
- Replace (space) with
-
(dash) - Remove
.
,(
, and)
- Remove any duplicate
-
(dashes) - Trim any
-
(dashes) from the beginning or end
Example
$slugger = new \GeoSocio\Slugger\Slugger(); echo $slugger->slug('St. Petersburg'); // st-petersburg
See more examples in tests/SluggerTest.php