abeliani/slug-helper

Helps to get a valid slug from the passed string

Installs: 16

Dependents: 1

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 0

pkg:composer/abeliani/slug-helper

v1.0.0 2024-05-08 22:00 UTC

This package is auto-updated.

Last update: 2025-10-09 00:54:34 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