uteq/signature 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

uteq/signature

Composer 安装命令:

composer require uteq/signature

包简介

A Package that gives the ability to create (temporary) links for usage on websites, emails and more

README 文档

README

Latest Version on Packagist Tests Total Downloads

This laravel package gives you the ability to create action links that can be used everywhere on your site (including emails).

A simple url can be created by the example below. The first parameter is the class to execute the action when the user visits the link, the second parameter is an array that holds all the data to be provided to the action class. The payload automatically gets encrypted when entering the database.

$url = SignatureFacade::make(Action::class, ['email' => 'dirk@example.com'])->get();

The get() function returns a complete url based on the APP_URL in the .env file and the 'action_route' in the signature config

Example action class:

class Action 
{
    public function __invoke($payload)
    {
        // Do something      

        return redirect('login');
    }
}

Installation

You can install the package via composer:

composer require uteq/signature

You can publish and run the migrations with:

php artisan vendor:publish --provider="Uteq\Signature\SignatureServiceProvider" --tag="migrations"
php artisan migrate

You can publish the config file with:

php artisan vendor:publish --provider="Uteq\Signature\SignatureServiceProvider" --tag="config"

This is the contents of the published config file:

return [
    /*
     * This will be the url Signature will use to handle the actions
     * if the action_route is action the url will for example be https://example.com/action/{key}
     */
    'action_route' => '/action/{key}',
    
    /*
    * Here you can optionaly define the actions, for example: 'action => '\App\SignatureActions\Action'
    * When making a url you can provide the key instead of the class path, 
    * when using the example above it would look like SignatureFacade::make('action', $payload)->get();
    */
    'actions' => [
        
    ]
];

Usage

You can create a link with the examples provided below. All options are optional and can be used independently.

$urlExample = SignatureFacade::make(Action::class)
    ->payload(['variable_1' => 'information', 'variable_2' => 'even more information'])
    ->expirationDate(now()->addWeek())
    ->password('secretPassword')
    ->oneTimeLink()
    ->get();

$longerKeyUrlExample = SignatureFacade::make(Action::class)
    ->longerKey(64)
    ->group('1234')
    ->get();
    
$customKeyExample = SignatureFacade::make(Action::class)
    ->customKey('veryCoolCustomKey')
    ->get();
  • payload(): Alternative way to pass variables to the link

  • expirationDate(): Option to allow you to specify the expiration date (defaults to 2 weeks from creating the link)

  • password(): Protects the link by asking for the password set in this function when using the link

  • oneTimeLink(): Deletes the link when the action has successfully executed

  • get(): Makes a complete url based on the APP_URL in the .env file and the 'action_route' in the signature config (defaults to /action/{key})

  • longerKey(): uses a longer key in the url with changeable length (max. 254). This is recommended when handling sensitive data.

  • group(): groups signatures together via the string given to the function, when a signature is deleted, all signatures with the same group also get deleted.

  • customKey(): grants the ability to use a custom key, if both longerKey() and customKey() are used in the same signature, the last function will override the other.

Action class:

class Action
{
    public function __invoke($payload)
    {
        // from here on you can use the variables in $payload to make the link actually do something;

        return redirect('/login'); // If no return is provided the user will be redirected to "/".
    }

}

Commands

This command deletes all the signatures that have expired.

php artisan signature:clean

Testing

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.

uteq/signature 适用场景与选型建议

uteq/signature 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 17 次下载、GitHub Stars 达 18, 最近一次更新时间为 2020 年 12 月 21 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「signature」 「uteq」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 uteq/signature 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 uteq/signature 我们能提供哪些服务?
定制开发 / 二次开发

基于 uteq/signature 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-12-21