{"id":36976412,"url":"https://github.com/mosaxiv/cakephp-token-verify","last_synced_at":"2026-01-13T22:15:57.002Z","repository":{"id":55943533,"uuid":"112065195","full_name":"mosaxiv/cakephp-token-verify","owner":"mosaxiv","description":"CakePHP3: Easily issue tokens that can be used for mail authentication.","archived":false,"fork":false,"pushed_at":"2020-10-15T08:30:29.000Z","size":28,"stargazers_count":9,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-11-06T20:13:00.788Z","etag":null,"topics":["cakephp","cakephp-plugin","cakephp3","php"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mosaxiv.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-11-26T07:48:35.000Z","updated_at":"2019-12-18T10:56:04.000Z","dependencies_parsed_at":"2022-08-15T10:00:49.253Z","dependency_job_id":null,"html_url":"https://github.com/mosaxiv/cakephp-token-verify","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/mosaxiv/cakephp-token-verify","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mosaxiv%2Fcakephp-token-verify","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mosaxiv%2Fcakephp-token-verify/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mosaxiv%2Fcakephp-token-verify/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mosaxiv%2Fcakephp-token-verify/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mosaxiv","download_url":"https://codeload.github.com/mosaxiv/cakephp-token-verify/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mosaxiv%2Fcakephp-token-verify/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28402212,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-13T14:36:09.778Z","status":"ssl_error","status_checked_at":"2026-01-13T14:35:19.697Z","response_time":56,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cakephp","cakephp-plugin","cakephp3","php"],"created_at":"2026-01-13T22:15:56.233Z","updated_at":"2026-01-13T22:15:56.997Z","avatar_url":"https://github.com/mosaxiv.png","language":"PHP","readme":"# Token Verify plugin for CakePHP3\n\n[![MIT License](http://img.shields.io/badge/license-MIT-blue.svg?style=flat)](LICENSE)\n[![Build Status](https://travis-ci.org/mosaxiv/cakephp-token-verify.svg?branch=master)](https://travis-ci.org/mosaxiv/cakephp-token-verify)\n\nJWT for mail authentication.  \n\nEasily issue tokens(JWT) that can be used for mail authentication.  \nNo need for token field in table.  \none-time/url-safe/safety :+1:\n\n# Requirements\n\n- PHP 7.0+\n- CakePHP 3.0.0+\n\n# Installation\n\n```\ncomposer require mosaxiv/cakephp-token-verify\n```\n\n# Example\n\n## reset password\n\n```sql\nCREATE TABLE users (\n    id INT AUTO_INCREMENT PRIMARY KEY, # Required\n    name VARCHAR(255) NOT NULL,\n    email VARCHAR(255) NOT NULL,\n    password VARCHAR(255) NOT NULL,\n    created DATETIME,\n    modified DATETIME # Required\n);\n```\n\n```php\n// app/src/Model/Entity/User.php\n\nuse Token\\Model\\Entity\\TokenTrait;\n\nclass User extends Entity\n{\n    use TokenTrait;\n}\n\n```\n\n```php\n// app/src/Controller/UsersController.php\n\nuse Cake\\Routing\\Router;\nuse Token\\Util\\Token;\n\nclass UsersController extends AppController\n{\n\n    public function forgotPassword()\n    {\n        if ($this-\u003erequest-\u003eis('post')) {\n            $email = $this-\u003erequest-\u003egetData('email');\n            $user = $this-\u003eUsers-\u003efindByEmail($email)-\u003efirst();\n            if ($user) {\n                $token = $user-\u003etokenGenerate();\n                $url = Router::url(['controller' =\u003e 'User', 'action' =\u003e 'resetPassword', $token], true);\n                // send email\n            }\n        }\n    }\n\n    public function resetPassword($token)\n    {\n        $user = $this-\u003eUsers-\u003eget(Token::getId($token));\n        if (!$user-\u003etokenVerify($token)) {\n            throw new \\Cake\\Network\\Exception\\NotFoundException();\n        }\n\n        if ($this-\u003erequest-\u003eis('post')) {\n            $user = $this-\u003eUsers-\u003epatchEntity($user, $this-\u003erequest-\u003egetData());\n            if ($this-\u003eUsers-\u003esave($user)) {\n                // success\n            } else {\n                // error\n            }\n        }\n    }\n}\n```\n\n\n# Usage\n\n## Required database field\n\n* `id` field\n* `modified` field\n\nBy using modified field, JWT can be used as one-time tokens.  \nJWT should be discarded when the table is updated.\n\n## Token\\Model\\Entity\\TokenTrait\n\nUsed in entity.\n\n### tokenGenerate($minits = 10)\n\n```php\n// token generate(default token expiration in 10 minits)\n$token = $entity-\u003etokenGenerate();\n\n// token generate(token expiration in 60 minits)\n$token = $entity-\u003etokenGenerate(60);\n```\n\n### tokenVerify($token)\n\n```php\n$user-\u003etokenVerify($token) // true or false\n```\n\n### setTokenData($name, $value)\n\n※ It does not encrypt the set data\n\n```php\n$user-\u003esetTokenData('test', 'testdata')\n```\n\n## Token\\Util\\Token\n\n### Token::getId($token)\n\n```php\nToken::getId($token) // id or false\n```\n\n### Token::getData($token, $name)\n\n```php\nToken::getData($token, 'test') // data or false\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmosaxiv%2Fcakephp-token-verify","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmosaxiv%2Fcakephp-token-verify","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmosaxiv%2Fcakephp-token-verify/lists"}