voku/urlify
PHP URL slugifier/transliterator (URLify.js port) that converts UTF-8 strings into readable, URL-safe slugs and filenames. Supports many languages via mapping tables with Portable ASCII fallback, plus helpers like downcode/transliterate and custom char rules.
^1.0 in composer.json)."Straße" → "strasse" (DE) vs. "strasse" (CH). Requires explicit locale specification./, ?, or # in input strings. Mitigate via input sanitization.URLify::filter() with debug: true (if supported) to inspect transformations.Str::slug() for consistency checks."ü" → "ue" vs. "u").URLify::add_chars()).Str::slug() for high-volume use cases.WHERE queries (e.g., ALTER TABLE posts ADD INDEX slug_idx(slug)).VARCHAR(255)) to avoid bloat.NULL, extremely long strings) could break slug generation.Str::slug() for critical paths:
try {
return URLify::filter($input);
} catch (\Exception $e) {
return Str::slug($input);
}
kebab-case vs. snake_case).Str::of()->slug() for defaults, voku/urlify for exceptions.URLify::filter($title, 60, 'de')).// Generate a slug for a blog post
$slug = URLify::filter($post->title, 60, app()->getLocale());
// Use in a route
Route::get('/posts/{slug}', [PostController::class, 'show']);
"Café au Lait" → "cafe-au-lait").URLify::add_chars(['©' => '(c)'])).voku/urlify?NULL inputs, locale mismatches).How can I help you explore Laravel packages today?