{"id":15025410,"url":"https://github.com/pageon/expiringtoken","last_synced_at":"2025-04-09T20:03:40.448Z","repository":{"id":57035117,"uuid":"82726817","full_name":"pageon/ExpiringToken","owner":"pageon","description":"A cryptographically safe token with a build in customizable expiration date","archived":false,"fork":false,"pushed_at":"2021-06-28T05:51:27.000Z","size":24,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-09T20:03:32.826Z","etag":null,"topics":["expiration","forgot-password","password-reset","php","php-7","token","token-authentication","tokens"],"latest_commit_sha":null,"homepage":"https://pageon.github.io/ExpiringToken/","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/pageon.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-02-21T21:03:13.000Z","updated_at":"2021-06-28T05:46:42.000Z","dependencies_parsed_at":"2022-08-23T20:50:58.356Z","dependency_job_id":null,"html_url":"https://github.com/pageon/ExpiringToken","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pageon%2FExpiringToken","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pageon%2FExpiringToken/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pageon%2FExpiringToken/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pageon%2FExpiringToken/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pageon","download_url":"https://codeload.github.com/pageon/ExpiringToken/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248103864,"owners_count":21048245,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["expiration","forgot-password","password-reset","php","php-7","token","token-authentication","tokens"],"created_at":"2024-09-24T20:02:18.171Z","updated_at":"2025-04-09T20:03:40.410Z","avatar_url":"https://github.com/pageon.png","language":"PHP","readme":"# Expiring Token\n\n[![Build Status](https://travis-ci.org/Pageon/ExpiringToken.svg?branch=master)](https://travis-ci.org/Pageon/ExpiringToken)\n[![License](https://poser.pugx.org/pageon/expiring-token/license.svg)](https://packagist.org/packages/pageon/expiring-token)\n[![Code Coverage](https://scrutinizer-ci.com/g/Pageon/ExpiringToken/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/Pageon/ExpiringToken/?branch=master)\n[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/Pageon/ExpiringToken/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/Pageon/ExpiringToken/?branch=master)\n\nThe expiring token generates a random token of 128 characters with an expiration date.\n\nThe token uses base64 but the length is calculated so that it is url safe, so no padding with the = character.\n\nThe actual token is generated with [random_bytes](http://php.net/manual/en/function.random-bytes.php) with a length of `32`\n\n## Installation\n\nYou can add this library as a local, per-project dependency to your project using [Composer](https://getcomposer.org/):\n\n    composer require pageon/expiring-token\n\n## Public api\n\n### ExpiringToken::create\n\nYou can create a new token this way. It accepts a [DateInterval](http://php.net/manual/en/class.dateinterval.php) as optional parameter to set a different expiration date.\n \nThe default expiration date is 3 days.\n\n### ExpiringToken::fromString\n\nUsed to create an instance of the token from the string representation\n\n### ExpiringToken::__toString\n\nThis turns the class instance into the string version of the token when the instance is used as or cast to a string.\n\n### ExpiringToken::validateAgainst\n\nThis can be used to validate the current token against an other token\n \n* When the tokens maths this method will return `true`\n* An `InvalidToken` exception will be thrown if the tokens don't match\n* An `TokenHasExpired` exception will be thrown if the token has expired\n\n### ExpiringToken::hasExpired\n\nReturns a bool indicating if the current token has expired\n\n### ExpiringToken::getExpiresOn\n\nCan be used to get the expiration date of the token\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpageon%2Fexpiringtoken","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpageon%2Fexpiringtoken","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpageon%2Fexpiringtoken/lists"}