geosocio/slugger

Creates URL Slugs from Strings

Installs: 90

Dependents: 1

Suggesters: 0

Security: 0

Stars: 2

Watchers: 1

Forks: 1

Open Issues: 0

pkg:composer/geosocio/slugger

1.1.2 2018-01-26 00:51 UTC

This package is auto-updated.

Last update: 2025-10-12 03:33:03 UTC


README

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