League URI Interfaces
This package contains an interface to represents URI objects according to RFC 3986.
You need:
$ composer require league/uri-interfaces
The
UriInterfaceinterface models generic URIs as specified in RFC 3986. The interface provides methods for interacting with the various URI parts, which will obviate the need for repeated parsing of the URI. It also specifies:
__toString()method for casting the modeled URI to its string representation.
jsonSerialize()method to improve interoperability with WHATWG URL Living standard
The
UriInterfaceinterface defines the following methods to access the URI string representation, its individual parts and components.
Modifying URI properties
The
Uriinterface defines the following modifying methods. these methods must be implemented such that they retain the internal state of the current instance and return an instance that contains the changed state.Delimiter characters are not part of the URI component and must not be added to the modifying method submitted value. If present they will be treated as part of the URI component content.
These methods will trigger a
League\Uri\Contract\UriExceptionexception if the resulting URI is not valid. The validation is scheme dependent.Relation with PSR-7
This interface exposes the same methods as
Psr\Http\Message\UriInterface. But, differs on the following keys:
httpand
httpsschemes to be supported.
nullvalue.
httpand
httpsschemes specific validation rules.
The
UriComponentInterfaceinterface models generic URI components as specified in RFC 3986. The interface provides methods for interacting with an URI component, which will obviate the need for repeated parsing of the URI component. It also specifies a
__toString()method for casting the modeled URI component to its string representation.
The
UriComponentInterfaceinterface defines the following methods to access the URI component content.
Modifying URI properties
The
UriComponentInterfaceinterface defines the following modifying method. this method must be implemented such that it retains the internal state of the current instance and return an instance that contains the changed state.UriComponentInterface extended interfaces
Because each URI component has specific needs most have specialized interface which all extends the
UriComponentInterfaceinterface. The following interfaces also exist:
League\Uri\Contract\AuthorityInterface
League\Uri\Contract\DataPathInterface
League\Uri\Contract\DomainHostInterface
League\Uri\Contract\FragmentInterface
League\Uri\Contract\UserInfoInterface
League\Uri\Contract\HostInterface
League\Uri\Contract\IpHostInterface
League\Uri\Contract\PathInterface
League\Uri\Contract\PortInterface
League\Uri\Contract\QueryInterface
League\Uri\Contract\SegmentedPathInterface
Contributions are welcome and will be fully credited. Please see CONTRIBUTING and CONDUCT for details.
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
The MIT License (MIT). Please see License File for more information.