PHPackages                             aldemco/secrets - 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. aldemco/secrets

ActiveLibrary

aldemco/secrets
===============

The package implements the functionality of creating, storing, checking secrets

1.1(2y ago)022MITPHPPHP ^8.0

Since Aug 24Pushed 2y ago1 watchersCompare

[ Source](https://github.com/aldemco/secrets)[ Packagist](https://packagist.org/packages/aldemco/secrets)[ Docs](https://github.com/aldemco/secrets)[ RSS](/packages/aldemco-secrets/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (2)Dependencies (15)Versions (3)Used By (0)

Secrets
=======

[](#secrets)

[![Latest Version on Packagist](https://camo.githubusercontent.com/fabbf519f1aa9103dcf0a8752efa84e129f82d0cc7bc14aa16c3d0a8c29e4f99/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f616c64656d636f2f6c61726176656c2d71756572792d6275696c6465722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/aldemco/secrets)[![Licence MIT](https://camo.githubusercontent.com/c16753c014e7d22d6ac73dd0a78de645f370c81a089eb4ee89d3b2ee5be3ad2f/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f616c64656d636f2f73656372657473)](https://github.com/aldemco/secrets/blob/main/LICENSE.md)[![Test Status](https://camo.githubusercontent.com/ab0c91467074cf04a3d2dc9802086231f5f306724decf928e2212b874f59a9e2/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f616c64656d636f2f736563726574732f72756e2d74657374733f6c6162656c3d7465737473)](https://github.com/aldemco/secrets/actions/workflows/run-tests.yml)

This package allows you to generate, store and verify secrets for many purposes, such as verifying a phone number during registration or authorization via SMS.

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

[](#installation)

You can install the package via composer:

```
composer require aldemco/secrets
```

You can publish and run the migrations with:

```
php artisan vendor:publish --tag="secrets-migrations"
php artisan migrate
```

if you want to change the default table name, then publish the config first

You can publish the config file with:

```
php artisan vendor:publish --tag="secrets-config"
```

This is the contents of the published config file:

```
return [
    'table' => 'secrets',
    'auto_clearing' => false,
    'auto_clearing_dayly_at' => '01:00',
    'length' => 6,
    'secret_generator' => Aldemco\Secrets\SecretGenerator::class,
    'secret_hasher' => Aldemco\Secrets\SecretHasher::class,
    'is_crypt' => false,
    'attemps' => 3,
    'store_until_minutes' => 50000,
    'valid_until_minutes' => 10,
    'valid_from_minutes' => 0,
    'multiple_limit' => 10,
];
```

Basic usage
-----------

[](#basic-usage)

Create secret
-------------

[](#create-secret)

```
use Aldemco\Secrets\Secrets;

/**
 * Full
 */
    Secrets::create(
        context:'Verify',
        contextId: null,
        owner: 'User',
        ownerId: 1 )
            ->length(6)
            ->setStoreUntil(Carbon\Carbon::now()->addDay(1))
            ->setValidUntil(Carbon\Carbon::now()->addMinutes(10))
            ->setAttemps(5)
            ->withInterval(60)
            ->genSecretStr(new Aldemco\Secrets\SecretGenerator)
            ->genCustomSecret(function(){
                return \Str::UUID()->toString();
            })
            ->encrypt(new Aldemco\Secrets\SecretHasher)
            ->save();

/**
 * Minimal
 */
Secrets::create()->save();
```

Verify secret
-------------

[](#verify-secret)

```
use Aldemco\Secrets\Secrets;

/**
 * Full
 */
Secrets::check(
    inputSecret: '112544',
    context:'Verify',
    owner: 'User',
    ownerId: 1)
        ->setEncrypt(new Aldemco\Secrets\SecretHasher)
        ->setUnlimitedAttemps()
        ->allowMultiple()
        ->setDissalowSuccessTimestamp()
        ->setUnlimitedAttemps()
        ->removeOnSuccess()
        ->verify()
        ->getResult();

/**
 * Minimal
 */

Secrets::check(inputSecret: '112544')->verify();
```

Commands
--------

[](#commands)

select: `all` `used` `unactive` `withoutAttemps` `expired`

```
php artisan secrets:clear {select} {context?}
```

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

[](#installation-1)

You can install the package via composer:

```
composer require aldemco/secrets

```

Testing
-------

[](#testing)

```
composer test

```

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity53

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 ~355 days

Total

2

Last Release

1006d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/a3d2bde27ba43dbe9b526cd6d59b1a2f69eee9765d9f91d2ee9dfd4c1aa6bdd3?d=identicon)[aldemco](/maintainers/aldemco)

---

Top Contributors

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

---

Tags

laravelsecretsaldemco

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

Type Coverage Yes

### Embed Badge

![Health badge](/badges/aldemco-secrets/health.svg)

```
[![Health](https://phpackages.com/badges/aldemco-secrets/health.svg)](https://phpackages.com/packages/aldemco-secrets)
```

###  Alternatives

[vormkracht10/laravel-mails

Laravel Mails can collect everything you might want to track about the mails that has been sent by your Laravel app.

24149.7k](/packages/vormkracht10-laravel-mails)[spatie/laravel-prometheus

Export Laravel metrics to Prometheus

2651.3M6](/packages/spatie-laravel-prometheus)[hydrat/filament-table-layout-toggle

Filament plugin adding a toggle button to tables, allowing user to switch between Grid and Table layouts.

6292.3k1](/packages/hydrat-filament-table-layout-toggle)[scalar/laravel

Render your OpenAPI-based API reference

6183.9k2](/packages/scalar-laravel)[ralphjsmit/laravel-helpers

A package containing handy helpers for your Laravel-application.

13704.6k2](/packages/ralphjsmit-laravel-helpers)[musahmusah/laravel-multipayment-gateways

A Laravel Package that makes implementation of multiple payment Gateways endpoints and webhooks seamless

852.2k1](/packages/musahmusah-laravel-multipayment-gateways)

PHPackages © 2026

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