{"id":27918629,"url":"https://github.com/hannasdev/token","last_synced_at":"2025-05-06T18:24:10.216Z","repository":{"id":84016642,"uuid":"53132580","full_name":"hannasdev/Token","owner":"hannasdev","description":"PHP token helper-class","archived":false,"fork":false,"pushed_at":"2016-03-04T12:27:45.000Z","size":1,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-03-27T20:21:52.079Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hannasdev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2016-03-04T12:01:18.000Z","updated_at":"2018-04-24T08:12:22.000Z","dependencies_parsed_at":null,"dependency_job_id":"6e3c6605-8f96-45b6-a1b2-61f41d7bed20","html_url":"https://github.com/hannasdev/Token","commit_stats":null,"previous_names":["hannasdev/token"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hannasdev%2FToken","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hannasdev%2FToken/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hannasdev%2FToken/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hannasdev%2FToken/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hannasdev","download_url":"https://codeload.github.com/hannasdev/Token/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252742220,"owners_count":21797184,"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":[],"created_at":"2025-05-06T18:24:09.587Z","updated_at":"2025-05-06T18:24:10.204Z","avatar_url":"https://github.com/hannasdev.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"Token\n=====\n\nToken is a helper-class for generating and storing and retrieving unique hashes in a `_SESSION`. It is intended to be used for Cross-Site-Request-Forgery (CSRF) protection.\n\n## Examples\n### generate() ###\nPHP:\n```php\n\u003cinput type=\"hidden\" name=\"csrf\" value=\"\u003c?php echo Token::generate(); ?\u003e\"/\u003e\n```\nHTML:\n```html\n\u003cinput type=\"hidden\" name=\"csrf\" value=\"\"/\u003e\n```\n\n### exists() ###\nPHP:\n```php\n\u003c?php\nif (Token::exists($_POST['csrf'])) { echo \"A token is stored in _SESSION.\"; }\n```\n\n### check() ###\nPHP:\n```php\n\u003c?php\nif (Token::check($_POST['csrf'])) { echo \"Token matches stored value.\"; }\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhannasdev%2Ftoken","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhannasdev%2Ftoken","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhannasdev%2Ftoken/lists"}