URLify

Fast PHP slug generator and transliteration library for turning any string into a clean URL.

Library
Composer
v1.2.5-stable
675stars
BSD-3-Clause-Clear

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
44/100Fair
Development Activity0
Maintenance20
Community76
Maturity60
Momentum20

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
65/100Good
Architecture60
Code Quality68
Innovation50
Learning Curve82

URLify is a PHP library for generating URL-safe slugs from arbitrary strings, including non-ASCII text. It transliterates accented Latin, Cyrillic, Greek, Arabic, Turkish, Ukrainian, Czech, Polish, and other alphabets down to their closest ASCII representation, then applies a configurable stop-word filter and separator (typically a hyphen) to produce a clean slug suitable for a URL path.

As a static utility class with no framework dependency, it’s a common building block behind “generate slug from title” behavior in PHP blogging platforms, static-site generators, and CMSes — the library itself originated from and is still used inside the Chyrp blogging engine.

What You Get

  • URLify::filter($string) for full string-to-slug conversion in one call
  • URLify::transliterate() for converting non-ASCII characters to ASCII without slugifying
  • URLify::downcode() for the raw character-mapping step
  • Per-language stop-word removal via remove_words() and reset_remove_list()
  • add_chars()/add_array_to_separator() to extend or override the built-in transliteration and separator maps

Common Use Cases

  • Auto-generating a URL slug from a blog post or page title on save
  • Normalizing user-generated content (usernames, tags, filenames) into URL-safe or filesystem-safe strings
  • Building SEO-friendly URLs from titles containing accented or non-Latin characters
  • Stripping common stop words (“a”, “the”, “and”) from slugs for cleaner, shorter URLs

Under The Hood

Architecture: URLify.php is a single static class exposing filter(), transliterate(), downcode(), and related helpers, built around large static transliteration maps (per-language character-to-ASCII lookup tables) and stop-word lists that are lazily merged/configurable via add_chars() and remove_words(); filter() composes downcode -> stop-word removal -> separator-join into the one common slugify call. Tech Stack: Plain PHP 7.2+, with voku/portable-ascii and voku/stop-words as its only two runtime Composer dependencies (delegating the heavy lifting of ASCII-portability and stop-word datasets to those focused libraries rather than reimplementing them). Code Quality: A compact ~600-line main file, tested with PHPUnit, linted via PHP CS Fixer (phpcs.php_cs) and statically analyzed with PHPStan (phpstan.neon) — modest but consistent tooling for a utility of this size and age (predates PSR-4, still using PSR-0 autoloading). API Design: The single most-used entry point (URLify::filter($string)) covers the common case in one static call, while the lower-level transliterate()/downcode() methods and the add_chars()/remove_words() customization hooks are there for callers who need finer control over the mapping or stop-word behavior.

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search