$uri = new Uri\Rfc3986\Uri("HTTPS://ex%61mpLE.com:443/foo/../bar/./baz?#fragment");
$uri->toRawString(); // returns "HTTPS://ex%61mpLE.com:443/foo/../bar/./baz?#fragment"
$uri->toString(); // returns "https://example.com:443/bar/baz?#fragment"
$url = new Uri\WhatWg\Url("HTTPS://🐘.com:443/foo/../bar/./baz?#fragment");
echo $url->toAsciiString(); // returns "https://xn--go8h.com/bar/baz?#fragment"
echo $url->toUnicodeString(); // returns "https://🐘.com/bar/baz?#fragment"This package provides a polyfill for the new native PHP URI parsing features to be included in PHP8.5. The polyfill works for PHP versions greater or equal to PHP8.1
⚠️ this is a sub-split, for development, pull requests and issues, visit: https://github.com/thephpleague/uri-src
To use the package, you require:
- PHP >= 8.1 but the latest stable version of PHP is recommended
- league/uri-interfaces
- rowbot/url
Tip
If you are using PHP 8.1, you SHOULD install symfony/polyfill-php82 to use its SensitiveParameter polyfill
Install the package using Composer.
composer require league/uri-polyfill:^7.6The RFC introduces:
- the
Uri\Rfc3986\Uriclass, an RFC 3986 compliant URI parser - the
Uri\WhatWg\Urlclass, an WHATWG compliant URL parser
Full documentation can be found on the Add RFC 3986 and WHATWG compliant URI parsing support RFC.
Uri\Rfc3986\UriBuilderclass, aUri\Rfc3986\Uriinstance builderUri\WhatWg\UrlBuilderclass, aUri\WhatWg\Urlinstance builderUri\Rfc3986\uri_percent_encodeto encode string according to RFC 3986Uri\WhatWg\url_percent_encodeto encode string according to RFC 3986](WHATWG)- And complementary
Enumsto describe URI shape and state.
Full documentation can be found on the PHP RFC: Followup Improvements for ext/uri.
Contributions are welcome and will be fully credited. Please see CONTRIBUTING and CONDUCT for details.
If you discover any security related issues, please email nyamsprod@gmail.com instead of using the issue tracker.
Please see CHANGELOG for more information on what has changed recently.
The MIT License (MIT). Please see LICENSE for more information.