PHPackages                             treehouselabs/slugifier - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. treehouselabs/slugifier

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

treehouselabs/slugifier
=======================

Slugifier

v1.0.1(11y ago)6220.2k—2.7%2MITPHPPHP &gt;=5.4

Since Jul 24Pushed 2y ago8 watchersCompare

[ Source](https://github.com/treehouselabs/slugifier)[ Packagist](https://packagist.org/packages/treehouselabs/slugifier)[ RSS](/packages/treehouselabs-slugifier/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)Dependencies (1)Versions (3)Used By (0)

Slugifier
=========

[](#slugifier)

Simple, extensible library that converts a string to a slug.

Another one?
------------

[](#another-one)

Yep, sorry. We think this one is pretty good though. Check out the features to see if it's good for you, too.

Features
--------

[](#features)

- Lightweight: no dependencies, other than the `mbstring` and `iconv` extensions, which are almost always present.
- Easy to use: `(new Slugifier())->slugify('Look Ma, no hands!'); // look-ma-no-hands`
- Handles special characters, all kinds of quotes, transliteration, HTML entities, and more. All out of the box.
- Extensible: add your custom translations
- PSR-4 compatible and written using PRS-2 coding guidelines [![Scrutinizer Code Quality](https://camo.githubusercontent.com/590e6089b3b7cf075bcf82b9aa96e66d10b266f57ac07016f79e9679c68fcc0a/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f74726565686f7573656c6162732f736c756769666965722f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/treehouselabs/slugifier/?branch=master)
- [Well-tested](/tests/TreeHouse/Slugifier/Tests/SlugifierTest.php) [![Build Status](https://camo.githubusercontent.com/fc019e19f600c0b4695fb50f3508724c054a67c9784ea7dafaa2905f489588bb/68747470733a2f2f7472617669732d63692e6f72672f74726565686f7573656c6162732f736c756769666965722e737667)](https://travis-ci.org/treehouselabs/slugifier)

Usage
-----

[](#usage)

```
$slugifier = new Slugifier();
$slugifier->slugify('Look má, I\'m a „slug”'); // look-ma-im-a-slug
```

Use a different delimiter:

```
$slugifier = new Slugifier();
$slugifier->slugify('Foo, bar & baz', '_'); // foo_bar_baz
```

Add special translations:

```
$slugifier = new Slugifier();
$slugifier->addTranslator(new EnglishTranslator());
$slugifier->slugify('Cow & chicken'); // cow-and-chicken
```

Or write your own:

```
class CowTranslator implements TranslatorInterface
{
    public function translate($str)
    {
        return str_ireplace('cow', 'supercow', $str);
    }
}

$slugifier = new Slugifier();
$slugifier->addTranslator(new CowTranslator());
$slugifier->slugify('Cow to the rescue'); // supercow-to-the-rescue
```

Changing the default behaviour
------------------------------

[](#changing-the-default-behaviour)

By default, special characters, quotes, HTML entities and more are converted. You can disable this behaviour by passing `false` to the constructor. This way you can start from scratch and add your own translators. The `iconv`transliteration is still performed though as we want to convert to ascii while preserving as much of the original data as possible.

###  Health Score

37

—

LowBetter than 83% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity39

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 81.8% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~53 days

Total

2

Last Release

4263d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/49e70c4936c5121b835d48680dcf4bb57d21724c533dd99591e80101e4a25dd6?d=identicon)[pkruithof](/maintainers/pkruithof)

![](https://www.gravatar.com/avatar/aa2b08ed7a87334a1a0b8e302759c3587e4cbea1a1efb08f23d55cd04d1ccfc0?d=identicon)[marcojanssen](/maintainers/marcojanssen)

---

Top Contributors

[![pkruithof](https://avatars.githubusercontent.com/u/330828?v=4)](https://github.com/pkruithof "pkruithof (9 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (1 commits)")[![igrizzli](https://avatars.githubusercontent.com/u/960937?v=4)](https://github.com/igrizzli "igrizzli (1 commits)")

---

Tags

urlslugslugifyslugifierurlize

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/treehouselabs-slugifier/health.svg)

```
[![Health](https://phpackages.com/badges/treehouselabs-slugifier/health.svg)](https://phpackages.com/packages/treehouselabs-slugifier)
```

###  Alternatives

[jbroadway/urlify

A fast PHP slug generator and transliteration library that converts non-ascii characters for use in URLs.

6737.4M62](/packages/jbroadway-urlify)[keyvanakbary/slugifier

A full-featured, simple, clean and pure functional implementation for creating slugs

68187.9k4](/packages/keyvanakbary-slugifier)[ausi/slug-generator

Slug Generator

8002.2M22](/packages/ausi-slug-generator)[pid/speakingurl

Generate of so called 'static' or 'Clean URL' or 'Pretty URL' or 'nice-looking URL' or 'Speaking URL' or 'user-friendly URL' or 'SEO-friendly URL' or 'slug' from a string.

1.1k5.3k1](/packages/pid-speakingurl)[voku/urlify

PHP port of URLify.js from the Django project. Transliterates non-ascii characters for use in URLs.

254.1M7](/packages/voku-urlify)[symfony-cmf/slugifier-api

Provides a basic slugifier interface to transform text into strings suitable for URLs

281.7M5](/packages/symfony-cmf-slugifier-api)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
