library expiring-hash
A utililty to easily create crypographically signed URLs for temporary ad-hoc URL access.
apinstein/expiring-hash
A utililty to easily create crypographically signed URLs for temporary ad-hoc URL access.
- Tuesday, April 1, 2014
- by apinstein
- Repository
- 1 Watchers
- 13 Stars
- 19,242 Installations
- PHP
- 1 Dependents
- 0 Suggesters
- 2 Forks
- 0 Open issues
- 2 Versions
- 14 % Grown
ExpiringHash, (*1)
Small helper class to create a URL parameter containing a tamper-proof expiration date., (*2)
This allows you to implement expiring URLs in the same way that Amazon S3 supports., (*3)
// create
$eh = new ExpiringHash('my secret');
$hash = $eh->generate("15 minutes");
$url = "http://foo.com/mydownload?hash={$hash}";
// verify
$eh = new ExpiringHash('my secret');
$okToDownload = $eh->validate($_GET['hash']);