raynl / generate-slug
Generate a unique slug on a collection
Installs: 477
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
pkg:composer/raynl/generate-slug
Requires
- php: ^7.3|^8.0
- statamic/cms: ^3
Requires (Dev)
- orchestra/testbench: ^6.18
- phpunit/phpunit: ^9.5
This package is auto-updated.
Last update: 2025-09-29 03:05:47 UTC
README
If you have a entry in a collection with the possibilty to have a duplicate slug, then you can call the generateslug. If the slug 'car' allready exists in the products collection it wil return 'car-1'
Slug::generateSlug('products', 'car')
If you want to customize the seperator add a third parameter that the seperator is.
Slug::generateSlug('products', 'car', '.')
It returns now "car.1"
As fourth parameter you can add the starting number.