Weave 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

Sluggable Laravel Package

x-laravel/sluggable

x-laravel/sluggable is a Laravel package that simplifies generating URL-friendly slugs for Eloquent models. It automatically creates clean, unique slugs from chosen source fields, helping you build readable routes and SEO-friendly URLs with minimal configuration.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • URL and SEO strategy. The package makes permalink structure a first-class product concern: which attributes build a slug, per-model, plus language-aware generation and numbered duplicates (slug-2). This supports decisions on whether URLs are title-derived, stable identifiers, or localized per market.
  • "Can users edit the title after publishing?" Slug history is the unlock here. Old slugs keep resolving via whereSlug(), findBySlug() and route model binding, so you can approve free renaming of published content without a bespoke redirect subsystem — a product decision teams usually defer or block outright.
  • Build vs. buy for redirects/legacy URLs. Replaces hand-rolled redirect tables and one-off slug-freezing hacks. The configurable reservation period and scheduled pruning turn "how long do we honour old links?" into a policy setting rather than an engineering project.
  • Localization roadmap. Language-aware slugs and shipped Turkish/English validation messages signal support for multi-market launches; relevant if roadmap includes regional sites or translated content without English-transliterated URLs.
  • Migration and replatforming work. Slug history materially de-risks URL changes during a CMS migration or domain restructure — retained old slugs absorb inbound links instead of a manual 301 map.
  • Multi-tenant and scoped products. Uniqueness checked across global scopes means slugs resolve correctly per tenant/workspace, avoiding cross-tenant collisions that would otherwise be a data-model decision.
  • Data retention and compliance. Pruning by age, chunk size and frequency (via model:prune, scheduled by the package) is a storage-vs-link-durability trade-off you can state explicitly rather than discover.
  • Platform/infra choices. Configurable connection, history table and history model support read-replica or separate-database topologies without forking.
  • Lifecycle integration. SlugChanged (after commit) plus slugChanging/slugChanged model events let marketing, search indexing and analytics react to URL changes without polling.

When to Consider This Package

Consider adoption when most of these hold:

  • Eloquent models back public-facing URLs, and SEO or shareable links matter.
  • Content is renamed after publication, or you want to permit that, and inbound links must survive.
  • You have — or are about to build — a redirect table, slug-freeze flag, or "don't change the title" rule.
  • URLs are localized, or you operate in Turkish/English markets and want validation messages and transliteration handled.
  • Models sit behind global scopes (multi-tenant, soft deletes, published-only), where naive uniqueness checks break.
  • You want framework-native mechanics — form-request validation rules (Rules\Slug, Rules\UniqueSlug including reserved slugs), model:prune, events — rather than another service to operate.
  • You are migrating URLs and need to preserve historical links for a defined window.

Look elsewhere or stay manual when:

  • The app is small and URLs are effectively immutable; a few lines in the model or an existing Str::slug call is sufficient and this adds surface area for no gain.
  • You need a full redirect manager: 301 chains, hit counting, redirect analytics, admin UI. Slug history is not a redirect product — plan for both or scope expectations accordingly.
  • The system is not Laravel/Eloquent, or slugs live in a non-relational store where the uniqueness-and-savepoint retry model doesn't apply.
  • Compliance requires immutable URLs or forbids retaining old identifiers — the history feature becomes a liability, and pruning must be near-zero.
  • You already run a CMS or platform with native permalink management.
  • Write concurrency on the slug column is extreme and you need coordination beyond per-request savepoint retries on the unique index.

Due diligence before committing: license and support terms, test coverage and maintenance cadence. This is a v1.0.0 initial release, so treat the public API as stabilising — pin the version and review subsequent releases for breaking changes, particularly around the HasSlug contract, history schema and config keys.

How to Pitch It (Stakeholders)

For executives: Content teams currently can't safely change a page title without breaking links and search rankings, or they pay engineering for one-off redirect work each time. This package makes URL changes safe by default — old links keep resolving for a configurable period — and folds slug generation, uniqueness and validation into the framework we already run. The business outcome is retained search traffic and fewer ad-hoc engineering requests, with no new infrastructure to operate and a retention setting that caps storage growth. Cost is integration time on a handful of models, not a platform migration.

For engineering: One trait and one interface per model, tunable per model for source attributes, regeneration behaviour and scoping. Uniqueness is enforced against global scopes with savepoint-based retry on the unique index, so races degrade to a retry rather than a 500 or a duplicate. History is a separate table/model/connection if we want it off the primary, pruned through model:prune on the package's scheduler with configurable age, frequency and chunk size. It uses standard Laravel seams — model events, a queued-safe post-commit SlugChanged event, and form-request validation rules including one that sees reserved slugs. No new services, no queue dependency, no vendor lock beyond the package itself.

Shared risk statement: The main judgement call is the reservation window — how long old URLs stay live versus how much history we retain. That is a product policy decision we should set deliberately at launch rather than leave at a default, and revisit if link durability turns out to matter more than we assumed.

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.
skyraptor/chatter
edlugz/sasapay
abbasudo/artisan-route
mirvan/ippanel
ignibyte/aic-framework
glavweb/data-schema-bundle
glavweb/datagrid-bundle
tacticmedia/scim-server
uni-method/frame
neika-ai/sdk
adachsoft/php-code-style
pharaonic/laravel-notification-dependencies
beautinow/translug
dev-brainiac/bot-cloaked
octoberrain/html
octoberrain/extension
octoberrain/exception
octoberrain/contracts
adachsoft/api-version-bundle
cgv/localized-resource