承接 think.studio/laravel-temporal-key 相关项目开发

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

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

think.studio/laravel-temporal-key

最新稳定版本:1.1.0

Composer 安装命令:

composer require think.studio/laravel-temporal-key

包简介

Create and retrieve random string key in database for any purposes.

README 文档

README

Packagist License Packagist Version Total Downloads Build Status Code Coverage Scrutinizer Code Quality

Create temporal random string key in database for any purposes. Key will be removed after expiration time or after max retrieve attempts.

Installation

Install the package via composer:

composer require think.studio/laravel-temporal-key

Optionally you can publish the config file with:

php artisan vendor:publish --provider="TemporalKey\ServiceProvider" --tag="config"

Migrate database

php artisan migrate

Add prune command to console kernel

$schedule->command('temporal-key:prune')->everyTenMinutes();

Usage

Default usage

Create key:

$key = \TemporalKey\Manager\TmpKey::create()->key()
// Customize default expiration datetime
$key = \TemporalKey\Manager\TmpKey::create(validUntil: \Carbon\Carbon::now()->addDay())->key()
// Add metadata
$key = \TemporalKey\Manager\TmpKey::create(['email' => 'user@email.com'])->key()
// Customise custom maximal retrieve count.
$key = \TemporalKey\Manager\TmpKey::create(usageMax: 22)->key()

Retrieve key

$temporalKey = \TemporalKey\Manager\TmpKey::find('testkey');

$temporalKey?->key();
$temporalKey?->meta();

Crete custom key type

use TemporalKey\Manager\TmpKey;

class ImagePreviewTmpKey extends TmpKey
{
    public static string $type = 'image-preview';
    public static int $defaultValidSeconds = 60 * 60;
    public static int $defaultUsageMax = 0; // unlimited
}

$key = ImagePreviewTmpKey::create()->key()
$temporalKey = ImagePreviewTmpKey::find('testkey');

Credits

  • Think Studio

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-08-20

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固