PHP Classes
elePHPant
Icontem

Bijection URL shortening: Encode and decode values for short URLs

Recommend this page to a friend!
  Info   View files Example   View files View files (2)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2015-08-10 (3 years ago) RSS 2.0 feedNot enough user ratingsTotal: 369 All time: 6,658 This week: 337Up
Version License PHP version Categories
bijection 1.1Artistic License5.0PHP 5, Libraries, Code Generation
Description Author

This class can encode and decode values for short URLs.

It can take a given id number for a short URL that will eventually be stored in a database and generates a sequence of random characters that will be used to associate to the short URL of the given id.

The generated short URL may have an optional check digit.

The class can also that a previously generated short URL and decode it to find the original identifier number or the URL.

Innovation Award
PHP Programming Innovation award nominee
September 2015
Number 9
URL shortening services are very popular. Usually they store in a database a long URL that corresponds to a short character sequence.

This class implements an algorithm that makes the short URL character sequence be derived by a number that can be the id of the database record stored in a database.

This fact allows saving an additional field that would otherwise be used to store the short URL key.

The use of a check digit allows doing prior validation of short URLs without performing a database lookup.

These details make this algorithm more efficient than the traditional ways used to map short to long URLs.

Manuel Lemos
  Performance   Level  
Name: Zhao <contact>
Classes: 3 packages by
Country: Japan Japan
Age: 43
All time rank: 22949 in Japan Japan
Week rank: 695 Up2 in Japan Japan Up
Innovation award
Innovation award
Nominee: 1x

 

  Files folder image Files  
File Role Description
Files folder imagerbib (1 directory)
Accessible without login Plain text file example.php Example demo for short url

  Files folder image Files  /  rbib  
File Role Description
Files folder imageutil (1 directory)

  Files folder image Files  /  rbib  /  util  
File Role Description
Files folder imagestring (1 directory)

  Files folder image Files  /  rbib  /  util  /  string  
File Role Description
Files folder imageencode (1 file)

  Files folder image Files  /  rbib  /  util  /  string  /  encode  
File Role Description
  Plain text file Bijection.php Class URL shortening algorithm

 Version Control Unique User Downloads Download Rankings  
 0%
Total:369
This week:0
All time:6,658
This week:337Up