mensbeam / uri
An implementation of the PHP URI extension for older PHP versions
1.0.0
2026-07-07 12:00 UTC
Requires
- php: >=7.1
- mensbeam/intl: ^0.9.4
- symfony/polyfill-intl-idn: ^1.0
Requires (Dev)
- bamarni/composer-bin-plugin: ^1.9
- pear/archive_tar: ^1.6
Suggests
- ext-intl: For faster and more accurate IDN handling
Provides
- ext-uri: 8.5.*
This package is auto-updated.
Last update: 2026-07-07 17:00:40 UTC
README
A polyfill for the PHP URI extension introduced in PHP 8.5. All features as of PHP 8.5.8 are replicated.
Features
- Compatibility back to PHP 7.1
- Passes all
urltestdata.jsonWeb Platform tests - Passes most PHP tests (see Differences below)
- Requires no PHP extensions
Differences
- The
Uri\Rfc3986\UriandUri\WhatWg\Urlclasses are neither final nor read-only Uri\Rfc3986\UriandUri\WhatWg\Urlobject serialization differ and are subject to change- Performing
var_export()onUri\Rfc3986\UriandUri\WhatWg\Urlobjects will yield different results - Casting
Uri\Rfc3986\UriandUri\WhatWg\Urlto array will yield different results - When using PHP 8.0 or earlier
Uri\UriComparisonModeandUri\WhatWg\UrlValidationErrorTypeare classes with a series of string constants rather than enumerations. - Where the enumerations
Uri\UriComparisonModeandUri\WhatWg\UrlValidationErrorTypeare used as parameter types, their types are not enforced - The result of converting an internationalized domain name to ASCII may differ
- The following PHP bugs are preemptively fixed:
- GH-22608: ext/uri: RFC 3986 initial-double-dot path can yield incorrect normalization
- GH-22618: ext/uri: RFC 3986 IPv6 handling is inconsistent
- GH-22628: ext/uri: Percent-encoding of caret in WHATWG URL paths is not performed
- GH-22629: ext/uri: WHATWG Validation error incorrect with empty host and non-empty userinfo
Availability
The polyfill is available on Packagist as mensbeam/uri, with source code available on my personal repository and mirrored on Codeberg.