承接 pforret/digestif 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

pforret/digestif

最新稳定版本:1.0.3

Composer 安装命令:

composer require pforret/digestif

包简介

This is my package digestif

README 文档

README

Latest Version on Packagist Tests Total Downloads

Package to create a digest of a string/array, to be used in creating unique unguessable URLs/folder names.

Installation

You can install the package via composer:

composer require pforret/digestif

Usage

use Pforret\Digestif\Digestif;

$dig = new Digestif(env("DIGEST_SEED"));
// seed value should be unique for that server/application.
// It's important that it is not known to the outside world.
// It should be the same for the application creating the Digest as the one reading/verifying it 

$url = "https://secure.example.com/invoice/1200323";
// if you make your URL like this, the URL for the other invoices can be guessed (e.g. 1200324, etc)

$digest = $dig->fromString($url);
$secure_url = "$url/$digest";
// URL = https://secure.example.com/invoice/1200323/0a1b-2c3d
// using a route /invoice/{id}/{digest} will allow you to verify the digest
// the URL of the next invoice 1200324 cannot be guessed without knowing the seed value

// or use this
$secure_url = "$url?$digest";
//URL = https://secure.example.com/invoice/1200323?0a1b-2c3d
// and then verify the digest before showing the actual invoice
if(!$dig->compareDigest($dig->fromString($url), $digest)){
    return false;
}
// 0a1b-2c3d will be ok, as 0a1b2c3d (without dash)

## Testing

```bash
composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.

统计信息

  • 总下载量: 11
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-09-14