PHPackages                             johnroyer/url-normalizer - 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. johnroyer/url-normalizer

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

johnroyer/url-normalizer
========================

Syntax based normalization of URL's

2.1.1(2y ago)11.5k[1 issues](https://github.com/johnroyer/url-normalizer/issues)1MITPHPPHP &gt;=8.0CI passing

Since Jan 9Pushed 10mo agoCompare

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

READMEChangelog (1)Dependencies (2)Versions (8)Used By (1)

Introduction
============

[](#introduction)

This URL normalizer is fork from [glenscott/url-normalizer](https://github.com/glenscott/url-normalizer) with some changes:

- upgrade PHPUnit to v9.x
- add parameter for removing tracking parameter (`utm_source`, `fbclid`, etc)

Syntax based normalization of URI's
===================================

[](#syntax-based-normalization-of-uris)

This normalizes URI's based on the specification RFC 3986

### Example usage

[](#example-usage)

```
require_once 'vendor/autoload.php';

$url = 'eXAMPLE://a/./b/../b/%63/%7bfoo%7d';
$un = new URL\Normalizer( $url );
echo $un->normalize();

// Result: 'example://a/b/c/%7Bfoo%7D'
```

### The normalization process preserves semantics

[](#the-normalization-process-preserves-semantics)

So, for example, the following URL's are all equivalent.

- `HTTP://www.Example.com/` and `http://www.example.com/`
- `http://www.example.com/a%c2%b1b` and `http://www.example.com/a%C2%B1b`
- `http://www.example.com/%7Eusername/` and `http://www.example.com/~username/`
- `http://www.example.com` and `http://www.example.com/`
- `http://www.example.com:80/bar.html` and `http://www.example.com/bar.html`
- `http://www.example.com/../a/b/../c/./d.html` and `http://www.example.com/a/c/d.html`
- `http://www.example.com/?array[key]=value` and `http://www.example.com/?array%5Bkey%5D=value`

### Normalizations performed

[](#normalizations-performed)

1. Converting the scheme and host to lower case
2. Capitalizing letters in escape sequences
3. Decoding percent-encoded octets of unreserved characters
4. Adding trailing `/`
5. Removing the default port
6. Removing dot-segments

For more information about these normalizations, please see the following Wikipedia article:

[http://en.wikipedia.org/wiki/URL\_normalization#Normalizations\_that\_Preserve\_Semantics](http://en.wikipedia.org/wiki/URL_normalization#Normalizations_that_Preserve_Semantics)

For license information, please see LICENSE file.

### Options

[](#options)

Two options are available when normalizing URLs which are disabled by default:

1. Remove empty delimiters. Enabling this option would normalize `http://www.example.com/?` to `http://www.example.com/` Currently, only the query string delimiter (`?`) is supported by this option.
2. Sort query parameters. Enabling this option sorts the query parameters by key alphabetically. For example, `http://www.example.com/?c=3&b=2&a=1` becomes `http://www.example.com/?a=1&b=2&c=3`
3. Remove tracking parameters. For examplem `https://example.com/?fbclid=xxxxx` becomes `https://example.com/?`

###  Health Score

35

—

LowBetter than 80% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity73

Established project with proven stability

 Bus Factor1

Top contributor holds 61.1% 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 ~613 days

Recently: every ~839 days

Total

7

Last Release

832d ago

Major Versions

1.4.0 → 2.1.02023-09-24

PHP version history (2 changes)v1.0.0PHP &gt;=5.3.0

2.1.0PHP &gt;=8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/134a7921f61f2b847c6f81e18d0cea923d1b877e2d86ff4f4322a99c4642c147?d=identicon)[johnroyer](/maintainers/johnroyer)

---

Top Contributors

[![johnroyer](https://avatars.githubusercontent.com/u/114491?v=4)](https://github.com/johnroyer "johnroyer (55 commits)")[![glenscott](https://avatars.githubusercontent.com/u/124257?v=4)](https://github.com/glenscott "glenscott (29 commits)")[![jamre](https://avatars.githubusercontent.com/u/1468331?v=4)](https://github.com/jamre "jamre (3 commits)")[![darius-telycenas](https://avatars.githubusercontent.com/u/2518048?v=4)](https://github.com/darius-telycenas "darius-telycenas (1 commits)")[![geraldbaeck](https://avatars.githubusercontent.com/u/199418?v=4)](https://github.com/geraldbaeck "geraldbaeck (1 commits)")[![szepeviktor](https://avatars.githubusercontent.com/u/952007?v=4)](https://github.com/szepeviktor "szepeviktor (1 commits)")

---

Tags

normalizerphpurl

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/johnroyer-url-normalizer/health.svg)

```
[![Health](https://phpackages.com/badges/johnroyer-url-normalizer/health.svg)](https://phpackages.com/packages/johnroyer-url-normalizer)
```

PHPackages © 2026

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