URL Normalizer: Normalize URLs according to RFC 3986

Recommend this page to a friend!
  Info   View files View files (4)   DownloadInstall with Composer Download .zip   Reputation   Support forum (2)   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 794 All time: 4,270 This week: 233Up
Version License PHP version Categories
url-normalizer 1.0.0BSD License5.0PHP 5, Text processing
Description Author

This class can be used to normalize URLs according to RFC 3986.

It can take a given URL and may fix it to perform syntax based normalization.

Specifically it may lower the case hexadecimal codes of encoded characters, decode characters which are not reserved, removed unnecessary relative path segments, and lower case of the URL scheme and host name.

Innovation Award
PHP Programming Innovation award nominee
February 2011
Number 2


Prize: One subscription to the PDF edition of the PHP Architect magazine
Sometimes the users enter URLs that despite browsers will accept them, they are not completely valid.

This class can normalize those URLs using RFC 3986 rules to make the URLs strictly valid.

Manuel Lemos
Picture of Glen Scott
Name: Glen Scott <contact>
Classes: 1 package by
Country: United Kingdom
Age: ???
All time rank: 2631119 in United Kingdom
Week rank: 1022 Up39 in United Kingdom Up
Innovation award
Innovation award
Nominee: 1x

Details
Syntax based normalization of URI's

This normalises URI's based on the specification RFC 3986 
http://www.apps.ietf.org/rfc/rfc3986.html

Example usage:
<code>
require_once 'URLNormalizer.php';

$url = 'eXAMPLE://a/./b/../b/%63/%7bfoo%7d';
$un = new URLNormalizer();
$un->setUrl( $url );
echo $un->normalize();

// result: "example://a/b/c/%7Bfoo%7D"
</code>

TODO:

Add further scheme-based normalization steps, as detailed in section 6.2.3 of the RFC.
  Files folder image Files  
File Role Description
Plain text file URLNormalizer.php Class Main class
Accessible without login Plain text file URLNormalizerTest.php Test Test class
Accessible without login Plain text file test-client.php Example Example script
Accessible without login Plain text file README Doc. README

 Version Control Unique User Downloads Download Rankings  
 0%
Total:794
This week:0
All time:4,270
This week:233Up
User Comments (2)
 
For more information send a message to info at phpclasses dot org.