oliwol/laravel-slugify
A Laravel package for generating URL-friendly slugs from strings. Provides a simple helper to turn titles and text into clean, readable slugs for routes, posts, and other model fields, with optional customization for separator and uniqueness.
composer require oliwol/laravel-slugify:^2.0. For existing v1 apps, composer update is generally enough, but still read UPGRADE.md.Post-style model, generate a slug from title, and use the model in route model binding. Begin with the #[Slugify] attribute for the simple case; move to slugConfig() only when the slug source or rules need to be dynamic.slugify-development skill is discovered — it is useful as an in-editor reference for package conventions and common patterns.#[Slugify] where the slug source is static and the same for every record. This keeps model code declarative and is the lowest-friction path for standard blog posts, pages, categories, etc.slugConfig() for conditional behavior. Use the fluent SlugConfig API when the slug source depends on runtime state: locale, tenant, fallback columns, or feature flags. Keep the closure small and deterministic — it should describe how to derive the slug, not perform unrelated business logic.appendId for editable public content. Enable ID-anchored slugs on models whose titles/slugs are likely to change. Route keys become {slug}-{id}, resolution happens by ID, and stale slugs receive a 308 canonical redirect. This is a good default for public marketing pages, product pages, and CMS content where SEO continuity matters.route('posts.show', $post) rather than hand-building /{slug} strings. This lets the package control the route key shape and keeps links correct if you later opt into appendId.200, stale slug returns 308 to the canonical URL, and the model resolves by ID even when the slug segment is outdated.appendId deliberately. Treat it as a routing change: update sitemaps, canonical tags, hard-coded links, API responses, and any external integrations that assume /{slug} URLs.slugify-development skill is auto-discovered by Laravel Boost and helps with scaffolding and conventions; it does not change runtime behavior.appendId changes route keys and URL shape. Existing apps are unaffected until enabled, but enabling it is a public URL change.308 during rollout. 308 is permanent and aggressively cached by browsers. If you are testing redirect behavior in staging or behind a proxy, verify cache headers and consider testing with a temporary redirect strategy before shipping.slugConfig() can capture request context. Tenant IDs, locales, and authenticated user state may not exist or may differ in queued jobs, console commands, and scheduled tasks. Pass explicit context or make the closure resilient to missing request state.php artisan route:list. Confirm whether the route key is {slug} or {slug}-{id} and that the correct model binding is registered. If a stale slug is not redirecting, check route registration before debugging the package.UPGRADE.md even for a “composer update” upgrade. It is short, but it documents the intended v1 → v2 path and any configuration changes worth verifying.SlugConfig fluent API or a small custom closure over forking package internals. Keep custom logic close to the model and covered by tests.How can I help you explore Laravel packages today?