apinstein/expiring-hash

A utililty to easily create crypographically signed URLs for temporary ad-hoc URL access.

v0.0.2 2013-02-12 16:48 UTC

This package is not auto-updated.

Last update: 2024-10-26 14:49:34 UTC


README

ExpiringHash

Small helper class to create a URL parameter containing a tamper-proof expiration date.

This allows you to implement expiring URLs in the same way that Amazon S3 supports.

// 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']);