PHPackages                             forthelocal/laravel-tokens - 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. forthelocal/laravel-tokens

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

forthelocal/laravel-tokens
==========================

php implementation of https://github.com/fnando/tokens.

v0.7.0(8y ago)0571MITPHPPHP ^7.1.8

Since Nov 13Pushed 8y ago5 watchersCompare

[ Source](https://github.com/forthelocal/laravel-tokens)[ Packagist](https://packagist.org/packages/forthelocal/laravel-tokens)[ RSS](/packages/forthelocal-laravel-tokens/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependencies (4)Versions (7)Used By (0)

Laravel Tokens
==============

[](#laravel-tokens)

PHP implementation of .

![PHP from Packagist](https://camo.githubusercontent.com/e5bd1c16441b8a87da08b81745ae40787e78a7ec9d410e8493b2e171789c39f1/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f666f727468656c6f63616c2f6c61726176656c2d746f6b656e732e737667)![Packagist](https://camo.githubusercontent.com/a4b7a1d8377c4252b62962b12857454a352b488c7f58770dcbcadcffaf57247b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f646f637472696e652f6f726d2e737667)

[![Build Status](https://camo.githubusercontent.com/5cad957b2f15c55000ea76b3ad0e8dab8f2d745a8db7f4b0df9e34d33221c686/68747470733a2f2f7472617669732d63692e6f72672f666f727468656c6f63616c2f6c61726176656c2d746f6b656e732e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/forthelocal/laravel-tokens)[![codecov](https://camo.githubusercontent.com/5b4c176b792648f2e341cd9470fab1934806532969687561ac98c30eec80bc40/68747470733a2f2f636f6465636f762e696f2f67682f666f727468656c6f63616c2f6c61726176656c2d746f6b656e732f6272616e63682f6d61737465722f67726170682f62616467652e737667)](https://codecov.io/gh/forthelocal/laravel-tokens)

Usage
-----

[](#usage)

### Installation

[](#installation)

```
composer require forthelocal/laravel-tokens
```

```
class User extends Model
{
    use Tokenizable;
}

// create a new user; remember that the token requires an existing record
// because it depends on its id
$user = User::create();

// create token that never expires
$user->addToken("activate");

// uses custom expires_at
user->addToken("valid", ["expires_at" => strtotime('1 day', time())]);

// uses the default size (48 characters)
$user->addToken("activate");

// uses custom size (up to 240)
$user->addToken("activate", ["length" => 120]);

// uses custom token value
$user->addToken("activate", ["token" => "abc123"]);

// create token with arbitrary data.
$user->addToken("activate", ["data" => [ "action" => "do something"]]);

// find token by name
$user->findTokenByName("reset_account");

// find valid token per user context.
$user->findValidToken("reset_account", "ea2f14aeac40");

// check if a token has expired
$user->tokens()->first()->isExpired();

// find user by token
User::findByToken("activate", "ea2f14aeac40");

// remove all expired tokens except those with NULL values
Token::clean();

// generate a token as string, without saving it
User::generateToken();

// remove a token by its name
$user->removeToken("activate");

// find user by valid token (same name, same hash, not expired)
User::findByValidToken("activate", "ea2f14aeac40");

// Token hash
echo $token; //=> ea2f14aeac40
```

License
=======

[](#license)

MIT

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 86.4% 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 ~4 days

Total

6

Last Release

3079d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/b2f2a3ed114a96ba7e0d75f8d18d54d9638696af4d7a83510f5d131f83efb8a1?d=identicon)[164c](/maintainers/164c)

---

Top Contributors

[![164c](https://avatars.githubusercontent.com/u/1281528?v=4)](https://github.com/164c "164c (19 commits)")[![higan96](https://avatars.githubusercontent.com/u/1230773?v=4)](https://github.com/higan96 "higan96 (2 commits)")[![ogawaso](https://avatars.githubusercontent.com/u/39783?v=4)](https://github.com/ogawaso "ogawaso (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/forthelocal-laravel-tokens/health.svg)

```
[![Health](https://phpackages.com/badges/forthelocal-laravel-tokens/health.svg)](https://phpackages.com/packages/forthelocal-laravel-tokens)
```

###  Alternatives

[barryvdh/laravel-ide-helper

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

14.9k123.0M687](/packages/barryvdh-laravel-ide-helper)[orchestra/canvas

Code Generators for Laravel Applications and Packages

21017.2M158](/packages/orchestra-canvas)[efureev/laravel-trees

Multi-Tree structures for Laravel

14253.3k4](/packages/efureev-laravel-trees)[illuminatech/balance

Provides support for Balance accounting system based on debit and credit principle

16137.4k](/packages/illuminatech-balance)[zonneplan/laravel-module-loader

Module loader for Laravel

24118.4k](/packages/zonneplan-laravel-module-loader)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

255.2k](/packages/aedart-athenaeum)

PHPackages © 2026

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