PHPackages                             ddd/slug - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. ddd/slug

ActiveLibrary

ddd/slug
========

v1.0(12y ago)816.8k↑87.5%1MITPHPPHP &gt;=5.3.0

Since Aug 15Pushed 12y ago3 watchersCompare

[ Source](https://github.com/ddd-php/Slug)[ Packagist](https://packagist.org/packages/ddd/slug)[ Docs](https://github.com/ddd-php/Slug)[ RSS](/packages/ddd-slug/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (2)Used By (1)

Slug: an agnostic slug generator
================================

[](#slug-an-agnostic-slug-generator)

**Slug** is a component which generates slugs easily whatever persistence mecanism you use (Propel2, Doctrine2, custom ORM...).

To generate a slug of a string there is always two 2 steps:

- The transliteration step which converts a given string from any writing system (French, Deutsh, Greek, Arabic...) into its ASCII representation.
- The slug generation step which basically separates each word and field by a custom delimiter.

Therefore **Slug** component has 2 services: `TransliteratorInterface` and `SlugGeneratorInterface`. Each of these services can have multiple implementations:

- `LatinTransliterator`: Transliterate a string written in any Latin alphabet (French, Deutsh, Spanish...) into its ASCII equivalent.
- `DefaultSlugGenerator`: Customize the word and field separator.
- `PatternSlugGenerator`: Complete customization of slug generation.

Installation
------------

[](#installation)

Using Composer, just require the `ddd/components` package:

```
{
    "require": {
        "ddd/components": "dev-master"
    }
}
```

Usage
-----

[](#usage)

To be able to slugify an entity or model, you just have to implement the `SluggableInterface`:

```
