PHPackages                             boomdraw/canonicalizer - 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. boomdraw/canonicalizer

ActiveLibrary

boomdraw/canonicalizer
======================

Canonicalizer package for Laravel

v2.0.0(6y ago)11.0k1MITPHPPHP ^7.2

Since Dec 6Pushed 6y ago1 watchersCompare

[ Source](https://github.com/boomdraw/canonicalizer)[ Packagist](https://packagist.org/packages/boomdraw/canonicalizer)[ Docs](https://github.com/boomdraw/canonicalizer)[ RSS](/packages/boomdraw-canonicalizer/feed)WikiDiscussions master Synced 2d ago

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

Canonicalizer
=============

[](#canonicalizer)

Canonicalizer package for Laravel

[![Build Status](https://camo.githubusercontent.com/242db8f201d4bd141000b7ef4432280ed490856bbd68319c23e02b5c3723f50f/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f6275696c642f672f626f6f6d647261772f63616e6f6e6963616c697a65722e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/boomdraw/canonicalizer)[![StyleCI](https://camo.githubusercontent.com/c1d1f24f5b14419bf7c9d03f3b2165fcebf5b3e82803d1bc75878cb10dd09750/68747470733a2f2f6769746875622e7374796c6563692e696f2f7265706f732f3232363431313235392f736869656c643f6272616e63683d6d6173746572)](https://github.styleci.io/repos/226411259)[![Code Coverage](https://camo.githubusercontent.com/7931e13d0c9921e758d47716d3e939bf166d8b0a5d09f5b1805d295acd7d59a6/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f626f6f6d647261772f63616e6f6e6963616c697a65722e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/boomdraw/canonicalizer)[![Quality Score](https://camo.githubusercontent.com/4868af87fa428255d11dcb2b2914c9cffc9ce17192c3fc8bd01f040a0c0cb269/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f626f6f6d647261772f63616e6f6e6963616c697a65722e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/boomdraw/canonicalizer)[![Latest Version on Packagist](https://camo.githubusercontent.com/a6789fadb438f36ab7c412acde672a8582ad41577defa6e7ff94b6e356c4422b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f626f6f6d647261772f63616e6f6e6963616c697a65723f7374796c653d666c61742d737175617265)](https://packagist.org/packages/boomdraw/canonicalizer)[![Total Downloads](https://camo.githubusercontent.com/d2ded22c423ac881620642d907096a085fa4e82a872801f7e46d6af4d351dc16/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f626f6f6d647261772f63616e6f6e6963616c697a65722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/boomdraw/canonicalizer)[![PHP Version](https://camo.githubusercontent.com/85403544694271bc1e5ca10c1e2489089ce77ba2a0af3c2ee87cd36c8f3a3429/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f626f6f6d647261772f63616e6f6e6963616c697a65723f7374796c653d666c61742d737175617265)](https://packagist.org/packages/boomdraw/canonicalizer)[![License](https://camo.githubusercontent.com/e0a773979c2781dab7170111f5341772e32ad1197797dca719c1c79fc3546c0b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f626f6f6d647261772f63616e6f6e6963616c697a65723f7374796c653d666c61742d7371756172653f7374796c653d666c61742d737175617265)](https://packagist.org/packages/boomdraw/canonicalizer)

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

[](#installation)

Via Composer

```
$ composer require boomdraw/canonicalizer
```

### Laravel

[](#laravel)

The package will automatically register itself.

### Lumen

[](#lumen)

Uncomment the following line in the bootstrap file:

```
// bootstrap/app.php:
$app->withFacades();
```

Register `CanonicalizerServiceProvider`

```
// bootstrap/app.php:
$app->register(Boomdraw\Canonicalizer\CanonicalizerServiceProvider::class);
```

Usage examples
--------------

[](#usage-examples)

```
use Boomdraw\Canonicalizer\Facades\Canonicalizer;
```

or

```
use Canonicalizer;
```

Methods
-------

[](#methods)

### Canonicalizer

[](#canonicalizer-1)

#### Canonicalizer::canonicalize()

[](#canonicalizercanonicalize)

Args `string $string, bool $nullEmpty = true`

Returns canonicalized string or `null` if `$nullEmpty = true` and the string is empty.

#### Canonicalizer::email()

[](#canonicalizeremail)

Args: `string $email`

Returns canonicalized email without dots before `@` or `null` if the string does not contain `@`

#### Canonicalizer::slug()

[](#canonicalizerslug)

Args: `string $title, string $separator = '-', ?string $language = 'en'`

`\Illuminate\Support\Str::slug()` alias

#### Canonicalizer::url()

[](#canonicalizerurl)

Args: `string $url, string $separator = '-'`

The function calls `trim()` function with slash (`/`) and backslash (`\`) added to charlist and slugs url path items with specified separator.

#### Canonicalizer::uri()

[](#canonicalizeruri)

Args: `sstring $url, string $separator = '-'`

`Canonicalizer::url()` alias

### Canonicalizer::macro()

[](#canonicalizermacro)

Args `string $name, object|callable $macro = true`

Canonicalizer uses Macroable trait, so you can add methods to a class dynamically.

```
Canonicalizer::macro('replaceSpaces', function(string $string) {
    return str_replace(' ', '', $string);
});

Canonicalizer::replaceSpaces('Hello World!') === 'HelloWorld!';
```

Testing
-------

[](#testing)

You can run the tests with:

```
composer test
```

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details and a todo list.

Security
--------

[](#security)

If you discover any security-related issues, please email  instead of using the issue tracker.

License
-------

[](#license)

[MIT](http://opensource.org/licenses/MIT)

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity18

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 80% 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 ~2 days

Total

3

Last Release

2346d ago

Major Versions

v1.1.0 → v2.0.02019-12-11

### Community

Maintainers

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

---

Top Contributors

[![JShantal](https://avatars.githubusercontent.com/u/9612943?v=4)](https://github.com/JShantal "JShantal (4 commits)")[![boomdraw](https://avatars.githubusercontent.com/u/12460074?v=4)](https://github.com/boomdraw "boomdraw (1 commits)")

---

Tags

laravelCanonicalizationcanonicalizerboomdraw

### Embed Badge

![Health badge](/badges/boomdraw-canonicalizer/health.svg)

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

###  Alternatives

[slowlyo/owl-admin

基于 laravel、amis 开发的后台框架~

61214.2k26](/packages/slowlyo-owl-admin)[erag/laravel-disposable-email

A Laravel package to detect and block disposable email addresses.

226102.4k](/packages/erag-laravel-disposable-email)[highsolutions/eloquent-sequence

A Laravel package for easy creation and management sequence support for Eloquent models with elastic configuration.

121130.3k](/packages/highsolutions-eloquent-sequence)[glhd/linen

21135.6k](/packages/glhd-linen)

PHPackages © 2026

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