Upgrading from 1.x to 2.x
uri-components:2.0 is a new major version that comes with backward compatibility breaks.
This guide will help you migrate from a 1.x version to 2.0. It will only explain backward incompatibility breaks, it will not present the new features (read the documentation for that).
If you are using composer then you should update the require section of your
composer require league/uri-components:^2.0
This will edit (or create) your
PHP version requirement
uri-components:2.0 requires a PHP version greater or equal than 7.2.0 (was previously 7.0.0).
Package replacements and conflicts
- replaces and deprecates without conflicting the
- partially replaces and deprecates without conflicting the
Host Public Suffix Resolution
This package no longer expose API to resolve Public Suffix List in Host. We recommend using a dedicated package for that like PHP Domain Parser.
Everything is final
Components objects are now all marked as final and implements at least one interface.
To use them you can either typehint against their interfaces or against a specific implementation but you can no longer extend them.
Because this new package targets PHP7.2+ the:
methods are removed in favor of
UriComponentInterface::getContent() method no longer takes any parameter and always returns the RFC3986 version of the URI component.
Host object no longer is iterable or exposes label related methods. To be able to access the host lables you need to instantiate a
All information regarding Public Suffix information has been removed from the package.
Query object public API has been updated to better match the WHATWG URL living standard URLSearchParams class.
You will need to upgrade your code to match this specification expected values.