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

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

glenscott/url-normalizer
========================

Syntax based normalization of URL's

1.4.0(11y ago)103948.9k↓41.3%16[9 issues](https://github.com/glenscott/url-normalizer/issues)[3 PRs](https://github.com/glenscott/url-normalizer/pulls)6MITPHPPHP &gt;=5.3.0CI failing

Since Jan 9Pushed 2y ago3 watchersCompare

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

READMEChangelog (2)DependenciesVersions (6)Used By (6)

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`

### TODO

[](#todo)

Add further scheme-based normalization steps, as detailed in section 6.2.3 of the RFC.

###  Health Score

43

—

FairBetter than 89% of packages

Maintenance18

Infrequent updates — may be unmaintained

Popularity53

Moderate usage in the ecosystem

Community26

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 82.9% 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 ~129 days

Total

5

Last Release

4016d ago

### Community

Maintainers

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

---

Top Contributors

[![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)")

### Embed Badge

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

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

PHPackages © 2026

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