sunrise / slugger
Slugger for PHP 7.1+ based on ICU
Installs: 6 947
Dependents: 0
Suggesters: 0
Security: 0
Stars: 10
Watchers: 4
Forks: 4
Open Issues: 6
Requires
- php: ^7.1|^8.0
- ext-intl: *
Requires (Dev)
- phpunit/phpunit: 7.5.20|9.5.0
- sunrise/coding-standard: 1.0.0
This package is auto-updated.
Last update: 2024-12-21 07:13:16 UTC
README
Installation
composer require sunrise/slugger
How to use
Russian to Latin (default)
use Sunrise\Slugger\Slugger; $slugger = new Slugger(); // syesh-yeshche-etikh-myagkikh-frantsuzskikh-bulok-da-vypey-chayu $slugger->slugify('Съешь ещё этих мягких французских булок, да выпей чаю');
Deutsch to Latin
use Sunrise\Slugger\Slugger; $slugger = new Slugger('de-ASCII'); // falsches-ueben-von-xylophonmusik-quaelt-jeden-groesseren-zwerg $slugger->slugify('Falsches Üben von Xylophonmusik quält jeden größeren Zwerg');
Custom replacements
$slugger = new Slugger(null, [ '.' => ' dot ', '@' => ' at ', ]); // admin@acme.com $slugger->slugify('admin-at-acme-dot-com');