PHPackages                             samj/doctrine-sluggable-bundle - 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. samj/doctrine-sluggable-bundle

ActiveLibrary

samj/doctrine-sluggable-bundle
==============================

Implementation for Doctrine2 sluggable behaviour for Symfony entities

v2.0(12y ago)162.6k3[6 issues](https://github.com/samjarrett/DoctrineSluggableBundle/issues)MITPHPPHP &gt;=5.3.2

Since Jan 2Pushed 6y ago2 watchersCompare

[ Source](https://github.com/samjarrett/DoctrineSluggableBundle)[ Packagist](https://packagist.org/packages/samj/doctrine-sluggable-bundle)[ RSS](/packages/samj-doctrine-sluggable-bundle/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependenciesVersions (2)Used By (0)

DoctrineSluggableBundle
=======================

[](#doctrinesluggablebundle)

The DoctrineSluggableBundle provides a neat implementation for Doctrine2 sluggable behaviour for your entities.

- Simple behaviour for generating unique slugs for your entities
- Neatly done by implementing an interface
- Ensures slugs don't duplicate
- Support iconv/transliterate e.g. é -&gt; e
- Uses dependency injection allowing you to implement custom slugger

The DoctrineSluggableBundle takes care of ensuring your slugs generated for your entity are unique. Simply have your entity implement the SluggableInterface interface your entities will automatically have slugs generated.

This uses the service container and dependency injection which allows you to easily create your own "Slugger" class. This supports you creating custom slugs to suit your domain problem.

This documentation is still under construction. However, an example is provided for any interested parties to begin experimenting with the package.

### Contributors

[](#contributors)

- Sam Jarrett ()
- Denis Chartier ()
- Cameron Manderson ()

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

[](#installation)

Simply run assuming you have installed composer.phar or composer binary :

```
$ php composer.phar require samj/doctrine-sluggable-bundle 2.0

```

Then add this in `app/AppKernel.php` :

```
new SamJ\DoctrineSluggableBundle\SamJDoctrineSluggableBundle(),

```

Example Entities
----------------

[](#example-entities)

### Example 1

[](#example-1)

In this example, the slug is built based on a single field: Note: Make sure you implement the accessor methods getId and getTitle

#### Code

[](#code)

```
