PHPackages                             albertotain/cakephp-recover-password - 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. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. albertotain/cakephp-recover-password

ActiveCakephp-plugin[Authentication &amp; Authorization](/categories/authentication)

albertotain/cakephp-recover-password
====================================

Easily issue tokens that can be used for mail authentication.

1.0(5y ago)047MITPHPPHP &gt;=7.0.0

Since Oct 15Pushed 2y ago1 watchersCompare

[ Source](https://github.com/albertotain/cakephp-recover-password)[ Packagist](https://packagist.org/packages/albertotain/cakephp-recover-password)[ Docs](https://github.com/albertotain/cakephp-recover-password)[ RSS](/packages/albertotain-cakephp-recover-password/feed)WikiDiscussions master Synced today

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

Token Verify plugin for CakePHP4
================================

[](#token-verify-plugin-for-cakephp4)

[![MIT License](https://camo.githubusercontent.com/db79b92834d905629b1aea42c9aa493da02060189e2af90840b1be5d6bf6ddf7/687474703a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e7376673f7374796c653d666c6174)](LICENSE)

JWT for mail authentication.

Easily issue tokens(JWT) that can be used for mail authentication.
No need for token field in table.
one-time/url-safe/safety 👍

Requirements
============

[](#requirements)

- PHP 8.1+
- CakePHP 4.4+

Example
=======

[](#example)

reset password
--------------

[](#reset-password)

```
CREATE TABLE users (
    id INT AUTO_INCREMENT PRIMARY KEY, # Required
    name VARCHAR(255) NOT NULL,
    email VARCHAR(255) NOT NULL,
    password VARCHAR(255) NOT NULL,
    created DATETIME,
    modified DATETIME # Required
);
```

```
// app/src/Model/Entity/User.php

use Token\Model\Entity\TokenTrait;

class User extends Entity
{
    use TokenTrait;
}
```

```
// app/src/Controller/UsersController.php

use Cake\Routing\Router;
use Token\Util\Token;

class UsersController extends AppController
{

    public function forgotPassword()
    {
        if ($this->request->is('post')) {
            $email = $this->request->getData('email');
            $user = $this->Users->findByEmail($email)->first();
            if ($user) {
                $token = $user->tokenGenerate();
                $url = Router::url(['controller' => 'User', 'action' => 'resetPassword', $token], true);
                // send email
            }
        }
    }

    public function resetPassword($token)
    {
        $user = $this->Users->get(Token::getId($token));
        if (!$user->tokenVerify($token)) {
            throw new \Cake\Network\Exception\NotFoundException();
        }

        if ($this->request->is('post')) {
            $user = $this->Users->patchEntity($user, $this->request->getData());
            if ($this->Users->save($user)) {
                // success
            } else {
                // error
            }
        }
    }
}
```

Usage
=====

[](#usage)

Required database field
-----------------------

[](#required-database-field)

- `id` field
- `modified` field

By using modified field, JWT can be used as one-time tokens.
JWT should be discarded when the table is updated.

Token\\Model\\Entity\\TokenTrait
--------------------------------

[](#tokenmodelentitytokentrait)

Used in entity.

### tokenGenerate($minits = 10)

[](#tokengenerateminits--10)

```
// token generate(default token expiration in 10 minits)
$token = $entity->tokenGenerate();

// token generate(token expiration in 60 minits)
$token = $entity->tokenGenerate(60);
```

### tokenVerify($token)

[](#tokenverifytoken)

```
$user->tokenVerify($token) // true or false
```

### setTokenData($name, $value)

[](#settokendataname-value)

※ It does not encrypt the set data

```
$user->setTokenData('test', 'testdata')
```

Token\\Util\\Token
------------------

[](#tokenutiltoken)

### Token::getId($token)

[](#tokengetidtoken)

```
Token::getId($token) // id or false
```

### Token::getData($token, $name)

[](#tokengetdatatoken-name)

```
Token::getData($token, 'test') // data or false
```

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity49

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

Unknown

Total

1

Last Release

2032d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/8ba1dc56d6046cdf03b188d0a48b907063a95a1385909c2058e2fa1a954cda3e?d=identicon)[AlbertoTain](/maintainers/AlbertoTain)

---

Top Contributors

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

---

Tags

jwtplugintokencakephp

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/albertotain-cakephp-recover-password/health.svg)

```
[![Health](https://phpackages.com/badges/albertotain-cakephp-recover-password/health.svg)](https://phpackages.com/packages/albertotain-cakephp-recover-password)
```

###  Alternatives

[dereuromark/cakephp-tinyauth

A CakePHP plugin to handle user authentication and authorization the easy way.

129228.6k10](/packages/dereuromark-cakephp-tinyauth)[admad/cakephp-jwt-auth

CakePHP plugin for authenticating using JSON Web Tokens

160680.3k8](/packages/admad-cakephp-jwt-auth)[bizley/jwt

JWT integration for Yii 2

67425.3k2](/packages/bizley-jwt)[xety/cake3-cookieauth

A simple Cake3 plugin to authenticate users with Cookies.

1954.7k2](/packages/xety-cake3-cookieauth)[ivanamat/cakephp3-aclmanager

AclManager plugin for CakePHP 3.x

2715.2k](/packages/ivanamat-cakephp3-aclmanager)

PHPackages © 2026

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