PHPackages                             alt3/cakephp-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. [Security](/categories/security)
4. /
5. alt3/cakephp-tokens

AbandonedArchivedCakephp-plugin[Security](/categories/security)

alt3/cakephp-tokens
===================

CakePHP plugin for generating various (secure) tokens

2831PHP

Since Aug 11Pushed 6y ago1 watchersCompare

[ Source](https://github.com/alt3/cakephp-tokens)[ Packagist](https://packagist.org/packages/alt3/cakephp-tokens)[ RSS](/packages/alt3-cakephp-tokens/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependenciesVersions (2)Used By (0)

cakephp-tokens
==============

[](#cakephp-tokens)

[![Build Status](https://camo.githubusercontent.com/628463034c4e868bed352ab35db5c1d767818a54807793a678b96a2cf03cf63d/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f616c74332f63616b657068702d746f6b656e732f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/alt3/cakephp-tokens)[![StyleCI Status](https://camo.githubusercontent.com/7914e9ae2b464a8a77ef6d4ace14ba4447ceb9fb0b811830862bce529be76b4e/68747470733a2f2f7374796c6563692e696f2f7265706f732f38303335313737382f736869656c64)](https://styleci.io/repos/80351778)[![Coverage Status](https://camo.githubusercontent.com/46c377e6ef71b513305027204f50965484192e48fb8475405018f02b6696a9d2/68747470733a2f2f696d672e736869656c64732e696f2f636f6465636f762f632f6769746875622f616c74332f63616b657068702d746f6b656e732f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://codecov.io/github/alt3/cakephp-tokens)[![Total Downloads](https://camo.githubusercontent.com/31cb39cb7eb55fa06e9720fac27c42ba5d0de746ab6c2da3f00bae1e886ed3fb/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f616c74332f63616b657068702d746f6b656e732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/alt3/cakephp-tokens)[![License](https://camo.githubusercontent.com/942e017bf0672002dd32a857c95d66f28c5900ab541838c6c664442516309c8a/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e7376673f7374796c653d666c61742d737175617265)](LICENSE.txt)

CakePHP plugin for generating various (secure) tokens.

[![Abandoned repository](./abandoned-repo.png "This repository is no longer maintained.")](./abandoned-repo.png)

Requirements
------------

[](#requirements)

- CakePHP 3.+

> PHP 5.x users are strongly advised to install the [paragonie/random\_compat](https://github.com/paragonie/random_compat)polyfill composer package to ensure generated tokens are truly secure.

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

[](#installation)

1. Install the plugin using composer:

    ```
    composer require alt3/cakephp-tokens:1.0.x-dev
    ```
2. To enable the plugin either run the following command:

    ```
    bin/cake plugin load Alt3/CakeTokens
    ```

    or manually add the following line to your `config/bootstrap.php` file:

    ```
    Plugin::load('Alt3/CakeTokens');
    ```
3. Create the required table used to store the tokens by running:

    ```
    bin/cake migrations migrate --plugin Alt3/CakeTokens
    ```

Usage
-----

[](#usage)

Inside your controller:

```
use Alt3\Tokens\RandomBytesToken

public function test() {

  // create a token object
  $token = new RandomBytesToken();
  $token->setCategory('password-reset');
  $token->setLifetime('+1 week');

  // save the token object
  $table = TableRegistry::get('Alt3/CakeTokens.Tokens');
  $entity = $table->newEntity($token->toArray());

  if ($table->save($entity)) {
    pr('Successfully saved token with id ' . $entity->id);
  }
}
```

> Visit [alt3/tokens](https://github.com/alt3/tokens) for more information about creating the token object and creating your own token-specific Adapters.

Methods
-------

[](#methods)

The `TokensTable` comes with the following methods:

- `setStatus($id, $status)`: set the status for token with id
- `deleteAllExpired()`: deletes all tokens that have expires
- `deleteAllWithStatus($status)`: deletes all tokens matching given status

Custom Finders
--------------

[](#custom-finders)

The `TokensTable` comes with the following custom finders:

- `findValidToken`: true when given token value (must be passed)exists, has status 0 and has not expired
- `findAllActive`: returns all tokens with status 0

Contribute
----------

[](#contribute)

Before submitting a PR make sure:

- [PHPUnit](http://book.cakephp.org/3.0/en/development/testing.html#running-tests)tests pass (`composer run-script tests`)
- [PSR-2 Code Sniffer](https://github.com/squizlabs/PHP_CodeSniffer)tests pass (`composer run-script cs`)
- [Coveralls Code Coverage ](https://coveralls.io/github/alt3/cakephp-tokens) remains at 100%

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity38

Early-stage or recently created project

 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.

### Community

Maintainers

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

---

Top Contributors

[![bravo-kernel](https://avatars.githubusercontent.com/u/230500?v=4)](https://github.com/bravo-kernel "bravo-kernel (6 commits)")

---

Tags

adapter-patterncakephptokens

### Embed Badge

![Health badge](/badges/alt3-cakephp-tokens/health.svg)

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

###  Alternatives

[defuse/php-encryption

Secure PHP Encryption Library

3.9k162.4M212](/packages/defuse-php-encryption)[roave/security-advisories

Prevents installation of composer packages with known security vulnerabilities: no API, simply require it

2.9k97.3M6.4k](/packages/roave-security-advisories)[mews/purifier

Laravel 5/6/7/8/9/10 HtmlPurifier Package

2.0k16.7M112](/packages/mews-purifier)[robrichards/xmlseclibs

A PHP library for XML Security

41278.1M118](/packages/robrichards-xmlseclibs)[bjeavons/zxcvbn-php

Realistic password strength estimation PHP library based on Zxcvbn JS

86917.5M63](/packages/bjeavons-zxcvbn-php)[enlightn/security-checker

A PHP dependency vulnerabilities scanner based on the Security Advisories Database.

33732.2M110](/packages/enlightn-security-checker)

PHPackages © 2026

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