arthens / request-signer
PHP library to sign and verify requests
Installs: 42 977
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 1
Requires
- php: >=5.3.2
Requires (Dev)
- phpunit/phpunit: ~3.7
This package is not auto-updated.
Last update: 2024-10-26 15:18:50 UTC
README
arthens/request-signer
is a PHP library to sign and validate requests.
The implementation is inspired by the AWS Rest Authentication tutorial.
Installation
Add arthens/request-signer
to your composer.json
.
You can also download request-signer
directly, as it doesn't have any dependency.
Usage
// Use composer or import the class manually require 'vendor/autoload.php'; // Create a new Signer $signer = new \Arthens\RequestSigner\Signer('here-your-secret-key'); // Generate a new url-friendly signature $signature = $signer->sign('GET', '/news'); // Verify a signature if (!$signer->verify('here-the-signature-from-request', 'GET', '/news')) { throw new \Exception('Invalid signature'); }