arthens/request-signer

该包的最新版本(0.1)没有提供许可证信息。

PHP库,用于对请求进行签名和验证

0.1 2014-03-24 08:48 UTC

This package is not auto-updated.

Last update: 2024-09-14 14:50:27 UTC


README

arthens/request-signer是一个PHP库,用于对请求进行签名和验证。

实现灵感来源于AWS Rest Authentication教程

Build Status

安装

arthens/request-signer添加到您的composer.json文件中。

您也可以直接下载request-signer,因为它没有依赖项。

用法

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