caturseptian/laravel-sluggable
A Laravel package for automatically generating and managing SEO-friendly slugs for Eloquent models. Customize slug sources, separators, and uniqueness rules to keep URLs clean, readable, and consistent across your application.
slugsShouldBeNoLongerThan) while still guaranteeing uniqueness via suffixes. That makes it a direct input into decisions like "do we shorten slugs for SEO/readability" versus "do we size the DB column to fit suffix growth." v1.0.2 makes the failure mode of a too-tight cap explicit (InvalidOption) instead of silently writing an overlong slug — so the constraint becomes a designed, testable rule rather than a data-quality landmine.sluggable:eject), which lets you adopt now and own the code later. That materially lowers the switching cost of the "buy" decision and de-risks the roadmap item "what happens if this package is abandoned or diverges from our needs."InvalidOption). This is a decision input: treat it as minor-level risk in your upgrade plan, and audit any environment where the configured max length is shorter than, or near, the generated suffix length (e.g., limit 1 with suffix -1).Adopt when:
Str::slug() call.InvalidOption behavior is a feature here: misconfiguration fails fast at the point of slugging instead of producing silently truncated/overlong data.Look elsewhere / defer when:
InvalidOption at runtime for those inputs; if you can't audit and adjust slugsShouldBeNoLongerThan / suffix config, stay pinned and plan the migration deliberately.Risk notes to carry into the decision: the thrown InvalidOption is the kind of change that appears in production rather than in tests, because it depends on runtime config plus actual content (long titles, numeric-only titles, non-Latin scripts producing short bases). Add a slug-generation regression test with your real config before rolling out, and confirm the exception is caught/handled wherever slugs are created in bulk (imports, backfills, seeders).
For executives (one paragraph): We're evaluating a small, focused Laravel package that handles URL slug generation — the "unique, readable, length-capped" part of publishing content. It's a commodity capability we shouldn't build from scratch, and the reason it's worth a look rather than a shrug is that it comes with an eject option: we can adopt it today and, if we ever want to, move its implementation into our own codebase in a single safe operation. That keeps our exit costs low while removing bespoke slug code from our maintenance burden. The latest patch (v1.0.2) is a quality release: it fixes a case where an over-long slug could be written silently, and it makes the eject operation all-or-nothing so a failed run can't leave an environment half-converted. The one thing to flag is that the fix is a behavior change — some configurations will now get a clear error instead of quietly bad data — so we need a short config audit as part of upgrading.
For engineering leads (summary):
slugsShouldBeNoLongerThan when the limit is shorter than the suffix (e.g., limit 1, suffix -1); it throws InvalidOption. This moves a silent data-integrity bug to a loud, catchable failure — good, but it's a runtime-only failure mode that depends on config plus real content, so add coverage before upgrading and handle the exception in bulk paths (imports, seeders, backfills).sluggable:eject is now atomic — files are written to a temp location and only moved if every write succeeds, so a partial failure can't leave a half-ejected application. This makes the command safe to run in scripted/CI contexts and makes "graduate off the package" a credible, documented runbook step rather than a manual, risky chore.slugsShouldBeNoLongerThan and suffix configuration across environments, and decide explicitly whether to pin or upgrade.How can I help you explore Laravel packages today?