Download the PHP package tobento/service-slugifier without Composer
On this page you can find all versions of the php package tobento/service-slugifier. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package service-slugifier
Slugifier Service
The slugifier service provides interfaces to convert a string into a slug with a default implementation.
Table of Contents
- Getting started
- Requirements
- Highlights
- Documentation
- Basic Usage
- Creating Slugifier
- Creating Custom Slugifier
- Generating Slugs
- Available Modifiers
- Alpha Num Only Modifier
- Limit Length Modifier
- Lowercase Modifier
- Modify Modifier
- Prevent Dublicate Modifier
- Regex Modifier
- Replace Modifier
- Strip Tags Modifier
- Trim Modifier
- Dictionaries
- English Dictionary Modifier
- French Dictionary Modifier
- German Dictionary Modifier
- Italian Dictionary Modifier
- Latin Dictionary Modifier
- Custom Modifier
- Slugs
- Available Resources
- Array Resource
- Custom Resource
- Available Resources
- Slugifiers
- Basic Usage
- Credits
Getting started
Add the latest version of the Slugifier service project running this command.
Requirements
- PHP 8.0 or greater
Highlights
- Framework-agnostic, will work with any project
- Decoupled design
- Creating custom slugifier to fit your requirements
Documentation
Basic Usage
Creating Slugifier
You may use the to easily create a slugifier.
Creating Custom Slugifier
You may use the class to build a custom slugifier by using the Available Modifiers.
Generating Slugs
Use the method to generate a slug from the given string.
Available Modifiers
Alpha Num Only Modifier
This modifier replaces non-alpha-num characters with the defined .
Limit Length Modifier
This modifier limits a string to the defined .
Lowercase Modifier
This modifier make a string lowercase.
Modify Modifier
Use this modifier to create a custom modifier using a .
Prevent Dublicate Modifier
This modifier prevents dublicate slugs. This modifier should be added last!
You may check out the Slugs section to learn more about it.
Regex Modifier
Use this modifier to modify the given string using the defined .
Replace Modifier
This modifier replaces the defined list from the given string.
Strip Tags Modifier
This modifier strip tags from the given string.
Trim Modifier
This modifier strip tags from the given string.
Dictionaries
English Dictionary Modifier
This modifier uses the english dictionary for replacements on locales starting with .
French Dictionary Modifier
This modifier uses the french dictionary for replacements on locales starting with .
German Dictionary Modifier
This modifier uses the german dictionary for replacements on locales starting with .
Italian Dictionary Modifier
This modifier uses the italian dictionary for replacements on locales starting with .
Latin Dictionary Modifier
This modifier uses the latin dictionary for replacements on all locales.
Custom Modifier
You may create a custom modifier by implementing the :
Slugs
You may use the class to check if a slug exists to prevent dublicate slugs.
addResource
You may use the method to add resources.
exists
Use the method to check whether a slug exists or not.
findSlug
Use the method which returns a single slug by the specified parameters or null if not found.
Available Resources
Array Resource
Custom Resource
You may create a custom resource by implementing the :
Slugifiers
You may use the class to add multiple slugifiers for later usage.
add
You may prefer the method to add a slugifier.
has
Use the method to check whether a slugifier exists or not.
get
Use the method to get a slugifier. If the slugifier does not exist a fallback slugifier is returned.
names
The method returns all slugifier names.
Credits
- Tobias Strub
- All Contributors