Skip to content

geosocio/slugger

Repository files navigation

Slugger Build Status Coverage Status

Create URL Slugs From UTF-8 Strings

Rules

  1. Trim Whitespace
  2. Lowercase (if possible)
  3. Replace (space) with - (dash)
  4. Remove ., (, and )
  5. Remove any duplicate - (dashes)
  6. 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

About

Create URL Slugs From UTF-8 Strings

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages