PHP Classes

PHP URL Compare: Compare two URLs and show the differences

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
StarStarStarStar 62%Total: 412 All time: 6,480 This week: 63Up
Version License PHP version Categories
url-compare 1.9BSD License5.3PHP 5, Text processing
Description 

Author

This class can compare two URLs and show the differences.

It can parse two given URLs and compare them to see if they are different.

The class ignores the order of query parameters so it can determine if the URLs are the same even if the order of the parameters is different.

It returns a string with the details of which parts of the URLs may be different.

Innovation Award
PHP Programming Innovation award nominee
October 2013
Number 5


Prize: One copy of the Zend Studio
Sometimes it is necessary to compare two URLs to determine if they represent the same page.

Comparing the URLs character by character may not be enough to determine if the URLs are different because they may represent the same URL with query parameters order switched.

This class can address that situation by parsing the URLs and comparing the query parameters one by one regardless of their order in the URLs.

Manuel Lemos
Picture of Yasir Siddiqui
  Performance   Level  
Name: Yasir Siddiqui <contact>
Classes: 14 packages by
Country: Pakistan Pakistan
Innovation award
Innovation award
Nominee: 8x

Winner: 1x

Details

url-difference ============== This class can calculate difference between two Urls. Generally it is difficult to find differences between two long URLs containing key value pairs. You have to "eye-ball" each URL and find difference especially when two urls have different parameters ordering. See example.php for more details.

  Files folder image Files (3)  
File Role Description
Accessible without login Plain text file example.php Example Example script
Accessible without login Plain text file README.md Doc. Documentation
Plain text file UrlDiffer.php Class Class source

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  
 100%
Total:412
This week:0
All time:6,480
This week:63Up
 User Ratings  
 
 All time
Utility:81%StarStarStarStarStar
Consistency:81%StarStarStarStarStar
Documentation:62%StarStarStarStar
Examples:75%StarStarStarStar
Tests:-
Videos:-
Overall:62%StarStarStarStar
Rank:920