tleckie/url-signer
Composer 安装命令:
composer require tleckie/url-signer
包简介
Create secured URLs with a limited lifetime in php
README 文档
README
Create secured URLs with a limited lifetime in php
Installation
You can install the package via composer:
composer require tleckie/url-signer
Usage
<?php use Tleckie\UrlSigner\Exception\UnsignedException; use Tleckie\UrlSigner\Exception\ExpiredUriException; use Tleckie\UrlSigner\Signer; // sign with expiration $signer = new Signer('password', 'signature','ttl',3600); $signed = $signer->sign('https://www.domain.com/path/?query=value'); // https://www.domain.com/path/?query=value&ttl=1619446592&signature=b42cb0868c6c46aad10d2a5f6e3c6503cd6b9668 try{ $signer->validate($signed); }catch(ExpiredUriException $exception){ // handle expired uri }catch(UnsignedException $exception){ // Decrypt failed } // sign without expiration $signer = new Signer('password', 'signature'); $signed = $signer->sign('https://www.domain.com/path/?query=value'); // https://www.domain.com/path/?query=value&signature=e39fe2feea843712dc2b3fa069a50c6965594f5b
统计信息
- 总下载量: 6
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2021-04-26