PHPackages                             think.studio/laravel-temporal-key - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. think.studio/laravel-temporal-key

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

think.studio/laravel-temporal-key
=================================

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

1.1.0(2y ago)017MITPHPPHP ^8.1

Since Nov 7Pushed 2y ago1 watchersCompare

[ Source](https://github.com/dev-think-one/laravel-temporal-key)[ Packagist](https://packagist.org/packages/think.studio/laravel-temporal-key)[ Docs](https://github.com/dev-think-one/laravel-temporal-key)[ RSS](/packages/thinkstudio-laravel-temporal-key/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (6)Versions (3)Used By (0)

Laravel temporal key.
=====================

[](#laravel-temporal-key)

[![Packagist License](https://camo.githubusercontent.com/5542d006eab0e40a45c53ae21a811bdc61016f457aec0c6e180cc279354d7644/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f7468696e6b2e73747564696f2f6c61726176656c2d74656d706f72616c2d6b65793f636f6c6f723d253233346463373166)](https://camo.githubusercontent.com/5542d006eab0e40a45c53ae21a811bdc61016f457aec0c6e180cc279354d7644/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f7468696e6b2e73747564696f2f6c61726176656c2d74656d706f72616c2d6b65793f636f6c6f723d253233346463373166)[![Packagist Version](https://camo.githubusercontent.com/a516e2904c6313e3989c0230d6503b866092c87b6c1bdab27c5c0d7a12d425fb/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7468696e6b2e73747564696f2f6c61726176656c2d74656d706f72616c2d6b6579)](https://packagist.org/packages/think.studio/laravel-temporal-key)[![Total Downloads](https://camo.githubusercontent.com/f6458429ff5c668ea63fa52c6b299faa037ac8d814d199f9b3bb4afc8a182ce1/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7468696e6b2e73747564696f2f6c61726176656c2d74656d706f72616c2d6b6579)](https://packagist.org/packages/think.studio/laravel-temporal-key)[![Build Status](https://camo.githubusercontent.com/b0c00cff7e6616e4fd33c24bdcd32ecf90569fb9b2c63d553885b67281125686/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6465762d7468696e6b2d6f6e652f6c61726176656c2d74656d706f72616c2d6b65792f6261646765732f6275696c642e706e673f623d6d61696e)](https://scrutinizer-ci.com/g/dev-think-one/laravel-temporal-key/build-status/main)[![Code Coverage](https://camo.githubusercontent.com/44820a9f4a517c463bd49322e9acde8c33f4a285f5c5c4402321a744fdf7688f/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6465762d7468696e6b2d6f6e652f6c61726176656c2d74656d706f72616c2d6b65792f6261646765732f636f7665726167652e706e673f623d6d61696e)](https://scrutinizer-ci.com/g/dev-think-one/laravel-temporal-key/?branch=main)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/e596ce4ebd6998d1ba1e1524cd1c4b2dbc4a4ed16ecaa865b1a3a28d9a252cc1/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6465762d7468696e6b2d6f6e652f6c61726176656c2d74656d706f72616c2d6b65792f6261646765732f7175616c6974792d73636f72652e706e673f623d6d61696e)](https://scrutinizer-ci.com/g/dev-think-one/laravel-temporal-key/?branch=main)

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

Installation
------------

[](#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
-----

[](#usage)

### Default 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

[](#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
-------

[](#credits)

- [![Think Studio](https://camo.githubusercontent.com/8e541bece07d503c85a126b5294865faa00e27371048772f566a0cce8c01fd3a/68747470733a2f2f7961726f736c617777772e6769746875622e696f2f696d616765732f73706f6e736f72732f7061636b616765732f6c6f676f2d7468696e6b2d73747564696f2e706e67)](https://think.studio/)

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~285 days

Total

2

Last Release

993d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/53f93fa87d58f33d106de6bd5e2946f8a345ebfaee146360746056cb134a15a0?d=identicon)[think.studio](/maintainers/think.studio)

---

Top Contributors

[![yaroslawww](https://avatars.githubusercontent.com/u/23663794?v=4)](https://github.com/yaroslawww "yaroslawww (4 commits)")

---

Tags

laraveltemporal

###  Code Quality

TestsPHPUnit

Static AnalysisPsalm

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/thinkstudio-laravel-temporal-key/health.svg)

```
[![Health](https://phpackages.com/badges/thinkstudio-laravel-temporal-key/health.svg)](https://phpackages.com/packages/thinkstudio-laravel-temporal-key)
```

###  Alternatives

[barryvdh/laravel-ide-helper

Laravel IDE Helper, generates correct PHPDocs for all Facade classes, to improve auto-completion.

14.9k123.0M683](/packages/barryvdh-laravel-ide-helper)[interaction-design-foundation/laravel-geoip

Support for multiple Geographical Location services.

17221.0k3](/packages/interaction-design-foundation-laravel-geoip)[nedwors/navigator

A Laravel package to ease defining navigation menus

433.1k](/packages/nedwors-navigator)[xefi/faker-php-laravel

Faker php integration with laravel

1915.1k](/packages/xefi-faker-php-laravel)[dcblogdev/laravel-junie

Install pre-configured guides for Jetbrains Junie

392.5k](/packages/dcblogdev-laravel-junie)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
