scholte / uri
There is no license information available for the latest version (1.1.2) of this package.
RFC 3986 PHP URI extension
1.1.2
2019-07-31 21:40 UTC
Requires
- php: >=7.1
- psr/http-message: ^1.0
Requires (Dev)
- phpstan/phpstan: ^0.11.8
- phpunit/phpunit: ^6.0
- psr/simple-cache: ^1.0
- symplify/easy-coding-standard: ^6.0
This package is auto-updated.
Last update: 2025-03-29 00:33:05 UTC
README
This object follows the PSR-7 HTTP message described at http://www.php-fig.org/psr/psr-7/ and RFC 3986. Every URI has a specific construction as shown below:
tel:+31-123-456-789
urn:oasis:names:specification:docbook:dtd:xml:4.1.2
ftp://ftp.is.co.za/rfc/rfc1808.txt
mailto:John.Doe@example.com
scheme:[//[user:password@]host[:port]][/]path[?query][#fragment]
- Protocol:
scheme
- Authentication:
user:password
- Domain:
www.host.com
- Port:
80
- Path:
/path
- Query:
?parameter=value
- Fragment:
#fragment
Installation
This package can be installed using composer:
$ composer require scholte/uri
How to use
The URI object can be used for all RFC 3986 URI's. It is possible to change or extract specific parts of the URI without having to search and replace those parts.
<?php use Scholte\Uri; $uri = new Uri('scheme://user:password@www.host.com:80/path?parameter=value#fragment'); echo $uri->setScheme('https')->getUri(URI_STRIP_FRAGMENT); // Output: https://user:password@www.host.com/path?parameter=value $uri = new Uri('http://www.host.com/path'); echo $uri->getUri(URI_STRIP_SCHEME|URI_STRIP_HOST); // Output: /path
About
Dependencies
- Works with PHP 7.1 or higher
- psr/http-message ^1.0
Author
Christiaan Scholte - cscholte_83@hotmail.com