abeliani / slug-helper
Helps to get a valid slug from the passed string
v1.0.0
2024-05-08 22:00 UTC
Requires
- php: ^8.1
Requires (Dev)
This package is auto-updated.
Last update: 2024-11-08 23:01:31 UTC
README
Customizable library for working with slug
Installation
composer require abeliani/slug-helper
Examples
Simple example
By default, the helper uses recommended filters to create a slug
$helper = new SlugHelper; print $helper(' `Test, a very good text !='); // test-a-very-good-text
Customize filters
For example, let's remove articles from a slug and change words separator
$helper = new SlugHelper(options: [FilterWords::class => ['a', 'an'], ReplaceSpaces::class => '+']); print $helper('A book with an apple'); // book+with+apple