michalsn/codeigniter-signed-url

为CodeIgniter 4框架提供URL签名功能

v2.1.0 2023-10-08 17:58 UTC

README

防止手动操作URL和自动过期URL。

PHPUnit PHPStan Deptrac Coverage Status

安装

composer require michalsn/codeigniter-signed-url

概述

我们可以使用两种主要方法轻松地对URL进行签名,这两种方法与CodeIgniter URL辅助函数类似。

echo signedurl()->siteUrl('controller/method?query=string');
// https://example.com/controller/method?query=string&signature=signature-goes-here
echo signedurl()->setExpiration(DAY * 2)->urlTo('namedRoute', 12);
// https://example.com/route/name/12?expiration=1671980371&signature=signature-goes-here

版本

版本不兼容 - 在一个版本的Signed URL中生成的URL无法与另一个版本一起工作。

文档

https://michalsn.github.io/codeigniter-signed-url