https://github.com/sunrise-php/slugger
Simple slugger for PHP 7.1+ based on ICU
https://github.com/sunrise-php/slugger
icu latin php-library php7 php8 slug slugger slugify translit transliterate transliteration transliterator
Last synced: about 1 year ago
JSON representation
Simple slugger for PHP 7.1+ based on ICU
- Host: GitHub
- URL: https://github.com/sunrise-php/slugger
- Owner: sunrise-php
- License: mit
- Created: 2018-10-23T17:08:19.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2025-05-02T10:29:49.000Z (about 1 year ago)
- Last Synced: 2025-05-02T11:39:33.774Z (about 1 year ago)
- Topics: icu, latin, php-library, php7, php8, slug, slugger, slugify, translit, transliterate, transliteration, transliterator
- Language: PHP
- Homepage:
- Size: 48.8 KB
- Stars: 10
- Watchers: 3
- Forks: 4
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Simple slugger for PHP 7.1+ based on ICU
[](https://gitter.im/sunrise-php/support)
[](https://circleci.com/gh/sunrise-php/slugger)
[](https://scrutinizer-ci.com/g/sunrise-php/slugger/?branch=master)
[](https://scrutinizer-ci.com/g/sunrise-php/slugger/?branch=master)
[](https://packagist.org/packages/sunrise/slugger)
[](https://packagist.org/packages/sunrise/slugger)
[](https://packagist.org/packages/sunrise/slugger)
## Installation
```bash
composer require sunrise/slugger
```
## How to use
#### Russian to Latin (default)
```php
use Sunrise\Slugger\Slugger;
$slugger = new Slugger();
// syesh-yeshche-etikh-myagkikh-frantsuzskikh-bulok-da-vypey-chayu
$slugger->slugify('Съешь ещё этих мягких французских булок, да выпей чаю');
```
#### Deutsch to Latin
```php
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
```php
$slugger = new Slugger(null, [
'.' => ' dot ',
'@' => ' at ',
]);
// admin@acme.com
$slugger->slugify('admin-at-acme-dot-com');
```
## Useful links
* http://site.icu-project.org/
* http://userguide.icu-project.org/transforms/general
* http://demo.icu-project.org/icu-bin/translit