Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Urlizer Laravel Package

aferrandini/urlizer

Laravel-friendly URL slug generator that “urlizes” strings into clean, readable slugs with sensible transliteration and customization options. Ideal for turning titles or names into SEO-ready URLs consistently across your app.

Deep Wiki
Context7

aferrandini/urlizer is a lightweight PHP/Laravel package for turning human-readable strings into clean, URL-friendly slugs. It focuses on predictable output and easy integration, making it handy for routes, SEO-friendly links, and database identifiers.

Designed to be simple and configurable, Urlizer helps normalize text by handling special characters and common formatting quirks while keeping your slugs consistent across your app.

  • Generate URL-safe slugs from titles or arbitrary text
  • Normalize casing, whitespace, and punctuation consistently
  • Handle accented characters and basic transliteration
  • Laravel-friendly usage for quick integration in projects
Frequently asked questions about Urlizer
How do I install and use aferrandini/urlizer in Laravel?
Run `composer require aferrandini/urlizer`, then register the service provider in `config/app.php`. Use the `Urlizer` facade or class directly: `Urlizer::urlize('Hello World!')` to generate `hello-world`. For Laravel 5–8, ensure the package is properly autoloaded via Composer.
Does this package work with Laravel 9 or 10?
No, this package is not officially supported for Laravel 9+. It was last updated in 2013 and may conflict with PHP 8.1+ features like strict typing or deprecated functions. Use alternatives like `spatie/sluggable` for modern Laravel versions.
What’s the difference between this and Laravel’s built-in `Str::slug()`?
`Str::slug()` is basic and lacks customization (e.g., handling accents or transliteration). This package offers predictable, configurable slugs with consistent normalization, making it ideal for SEO or legacy systems where `Str::slug()` falls short.
Can I customize how special characters or accents are handled?
Yes, the package allows basic configuration for transliteration and punctuation removal. However, it lacks advanced Unicode normalization (NFD/NFKC) or dynamic rule sets. For complex needs, consider alternatives like `cocur/slug-generator`.
Will this break if I upgrade PHP to 8.1+?
Potentially. The package targets PHP 5.3+ and may trigger deprecation warnings for functions like `strtolower` or `preg_replace`. Wrap usage in a compatibility layer or fork the package for modern PHP support.
How does it handle slug collisions (e.g., duplicate URLs)?
This package generates slugs deterministically but doesn’t include built-in collision detection. You’ll need to manually append counters (e.g., `-2`) or use Laravel’s `Str::slug()` fallback for uniqueness checks.
Is there a way to cache slugs for performance?
No, the package doesn’t include caching. For high-traffic apps, cache generated slugs in Redis or the filesystem using Laravel’s cache system, or batch-process slugs during off-peak hours.
Does it support multilingual or non-Latin scripts (e.g., Arabic, Chinese)?
No, this package focuses on basic Latin transliteration. For multilingual support, use alternatives like `spatie/sluggable` or `cocur/slug-generator`, which handle advanced Unicode normalization and transliteration rules.
How do I integrate this with Eloquent models for automatic slugging?
Manually add a `getSlugAttribute()` mutator to your model or use an accessor. Example: `public function getSlugAttribute() { return Urlizer::urlize($this->title); }`. For bulk operations, consider a model observer or service layer.
Are there any alternatives if this package isn’t maintained?
Yes. For Laravel, try `spatie/sluggable` (modern, feature-rich) or `cocur/slug-generator` (lightweight, Unicode-friendly). For non-Laravel PHP, `symfony/webpack-encore`’s slug utilities or custom regex-based solutions may suffice.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
comsave/common
alecsammon/php-raml-parser
chrome-php/wrench
lendable/composer-license-checker
typhoon/reflection
mesilov/moneyphp-percentage
mike42/gfx-php
bookdown/themes
aura/view
aura/html
aura/cli
povils/phpmnd
nayjest/manipulator
omnipay/tests
psr-mock/http-message-implementation
psr-mock/http-factory-implementation
psr-mock/http-client-implementation
voku/email-check
voku/urlify
rtheunissen/guzzle-log-middleware