cviebrock/eloquent-sluggable
66.6
Adequate · 19 September 2026
769
lines of production code
PHP
primary language
1
measurement over time
What this system is
This system is a Laravel package that provides configurable slug generation for Eloquent models. It allows developers to customize how URL-friendly strings are created, including options for length, uniqueness, and timing relative to model saves. The package includes a test suite and modern tooling to ensure reliable slug handling across various model configurations.
Features
New configurable slug generation settings
A new configuration file for the sluggable feature has been introduced, allowing users to customize how slugs are generated and managed. Key options include setting a maximum length with word-boundary preservation (\maxLength\, \maxLengthKeepWords\), defining custom slug generation methods (\method\), controlling uniqueness behavior (\unique\, \firstUniqueSuffix\), and determining whether slugs update on model saves (\onUpdate\). This provides granular control over URL-friendly string generation for Eloquent models.
resources · high confidence
Removals
Removal of legacy Laravel 3 service provider and facade
The legacy Laravel 3 compatibility layer has been removed, specifically deleting the \Sluggable\ facade, the \Sluggable\ core class, and the \SluggableServiceProvider\. This eliminates the old event-listening mechanism (\eloquent.saving\*\) and the service container binding (\sluggable\) in favor of the updated 4.0 implementation, requiring users to rely on the new trait-based approach for slug generation.
src/Cviebrock · high confidence
Behavioural changes
Configurable slug generation timing via observer pattern
The library now uses an Eloquent Observer to handle slug generation, allowing users to configure whether slugs are generated before or after the model is saved. By default, slugs are still generated during the 'saving' event, but the new \sluggableEvent()\ method in the Sluggable trait lets you switch to the 'saved' event. This change enables using the model's primary key as part of the slug source, which is impossible during the 'saving' phase because the ID has not yet been assigned. The ServiceProvider registers the SluggableObserver, and the SluggableScopeHelpers trait remains available for querying by slug.
src · high confidence
Introduction of extensible SlugService with improved slug generation logic
The \src/Services/SlugService.php\ file introduces a new service class that centralizes slug generation logic for Eloquent models. This change allows the service to be extended and provides more robust handling of slug attributes, including fixes for reserved word collisions and proper checking for empty strings. The service now supports configuration overrides, custom slug engines, and ensures that slugs truncated by \maxLength\ do not end in a separator. It also handles falsy values like \0\ and \'0'\ correctly, making boolean false values slugifiable. This refactoring simplifies the Laravel 5.1/5.2/Lumen compatibility and improves the overall reliability of slug generation.
src/Services · high confidence
Removal of default configuration file
The default configuration file (src/config/config.php) and its placeholder have been removed from the package. Users can no longer rely on the package-provided defaults for slug generation settings such as build attributes, storage field, uniqueness enforcement, and update behavior; they must now explicitly provide their own configuration values or merge them into their application's config.
src/config · high confidence
Removal of placeholder file in public directory
The .gitkeep placeholder file in the public directory has been removed, indicating that the directory is now populated with actual content or is managed differently.
public · medium confidence
Updated PHPUnit configuration to version 10.5
The \phpunit.xml\ configuration file has been updated to align with PHPUnit 10.5, introducing a new schema location and enabling \stopOnFailure\ by default. The configuration now explicitly defines coverage reporting to HTML output in the \build/coverage\ directory, JUnit logging to \build/report.junit.xml\, and source inclusion for the \src/\ directory. Additionally, the \.gitignore\ has been updated to exclude the new \.phpunit.cache\ directory and the \build/\ folder.
(repo-wide) · high confidence
Test coverage
Added database migration files for testing; Expanded test model suite for slug configuration scenarios; Initial test suite for Eloquent Sluggable.
Dependencies
Upgrade to Laravel 13 and PHP 8.3 with modernized tooling
The package now requires PHP 8.3 and Laravel 13, dropping support for older versions. It has migrated to PSR-4 autoloading, adopted Pest for testing, and updated its core dependency to cocur/slugify 4.3. Composer scripts for static analysis (PHPStan), code style (PHP-CS-Fixer), and testing have been added to streamline development and maintenance.
(dependencies) · high confidence
Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
How this codebase got here
Baseline
- First survey — no prior run to compare against. CAI 67.
Lenses
- Code Health 100
- Architecture 69
- Maturity 56
- Readiness 69
- Security 100
Changes since last survey
- 300 commits — 226 feature/other, 74 fixes
By area
- (root) — 170 commits
- (repo) — 56 commits
- src/Services — 17 commits
- .github/workflows — 10 commits
- src/SluggableObserver.php — 10 commits
- tests/BaseTests.php — 10 commits
- tests/Models — 8 commits
- resources/config — 2 commits
- src/ServiceProvider.php — 2 commits
- src/Sluggable.php — 2 commits
- src/SluggableScopeHelpers.php — 2 commits
- tests/Models2 — 2 commits
- tests/ScopeHelperTests.php — 2 commits
- .github/FUNDING.yml — 1 commit
- .github/ISSUE_TEMPLATE.md — 1 commit
- src/PrimarySlug.php — 1 commit
- tests/EventTests.php — 1 commit
- tests/OnUpdateTests.php — 1 commit
- tests/RelationTests.php — 1 commit
- tests/TestCase.php — 1 commit
Notable commits
- fix: Add a test that demonstrates saved observer bug
- fix: Add slugEngineOptions, fixes #454
- fix: Allow SlugService to be extended + fix for validateSlug reserved collisions
- fix: Clarification when using custom trait to extend methods (fixes #544)
- fix: Fix #543 again
- fix: Fix broken self-referencing link
- fix: Fix event tests
- fix: Fix for L5.1
- fix: Fix links
- fix: Fix observer return values and expand test
- fix: Fix return value for #543
- fix: Fix saving
- fix: Fix wrong syntax
- fix: Fixed issue #527 - to use proper checking for empty string for slug attribute
- fix: Fixed the path of the sluggable.php config file
- fix: Fixes #402
- fix: Fixes #596
- fix: Fixes comma omission between array elements in documentation code sample
- fix: Merge branch 'config-fix'
- fix: Merge pull request #282 from cybercog/hotfix/separator-typo
- …and 280 more
Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
Survey your own repository
cviebrock/eloquent-sluggable was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.
About this page
- The score is its most recent published measurement, taken on 19 September 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
- Measured at commit 431f609a499f126c244653f064d8306e908224fa — the exact code this score is about.
- Scored under rubric-2026.09.15 — the same rubric and the same method as every other entry in this index.
- Measured by watchdog.canine.dev using codehealth-analyzer preprod-13a154b7f5d1.