https://github.com/apinstein/expiringhash
Simple class for generating secure, expiring URLs
https://github.com/apinstein/expiringhash
Last synced: 12 months ago
JSON representation
Simple class for generating secure, expiring URLs
- Host: GitHub
- URL: https://github.com/apinstein/expiringhash
- Owner: apinstein
- Created: 2011-11-17T19:24:07.000Z (over 14 years ago)
- Default Branch: master
- Last Pushed: 2014-04-01T14:14:09.000Z (over 12 years ago)
- Last Synced: 2025-05-23T17:31:25.313Z (about 1 year ago)
- Language: PHP
- Homepage: http://pearfarm.org/apinstein/ExpiringHash
- Size: 121 KB
- Stars: 13
- Watchers: 1
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
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.
```php
// 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']);
```