Skip to content
This repository was archived by the owner on Jul 28, 2019. It is now read-only.

nfang/php-urx

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Usage

Instantiation

Instantiate URL/URN instances by invoking factory method with valid URI string representation.

$url = Uri::create('http://www.example.com/test.html?name=john&age=28&gender=male#page1');

$urn = Uri::create('urn:isbn:0451450523');

Access parts

Access URL/URN parts through a series of get methods. Returned values are URL encoded.

$url = Uri::create('http://www.example.com/test.html?name=john duncan&age=28&gender=male#page1');

$url->getScheme(); // http

$url->getQueryParams()['name']; // john+duncan

Resolve URL

Take a relative URL, and resolve it based on the current instance.

$baseUrl = Uri::create('http://www.example.com/parent/child/index.html');

$baseUrl->resolve('rela.html'); // http://www.example.com/parent/child/rela.html

$baseUrl->resolve('../main.html'); // http://www.example.com/parent/main.html

// Supports chaining
$baseUrl->resolve('../main.html')->resolve('rela.html'); // http://www.example.com/parent/rela.html

About

An abstraction for URI, URL, URN in PHP

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages