PHP Classes

URL Normalizer: Normalize URLs according to RFC 3986

Recommend this page to a friend!
     
  Info   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
StarStarStar 57%Total: 798 All time: 4,291 This week: 36Up
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
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 (4)  
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

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 0%
Total:798
This week:0
All time:4,291
This week:36Up
User Ratings User Comments (2)
 All time
Utility:75%StarStarStarStar
Consistency:75%StarStarStarStar
Documentation:-
Examples:66%StarStarStarStar
Tests:58%StarStarStar
Videos:-
Overall:57%StarStarStar
Rank:1660