{"id":22044776,"url":"https://github.com/cradlephp/cradle-csrf","last_synced_at":"2026-05-19T07:34:23.353Z","repository":{"id":56958549,"uuid":"124831109","full_name":"CradlePHP/cradle-csrf","owner":"CradlePHP","description":"CSRF helpers for CradlePHP","archived":false,"fork":false,"pushed_at":"2020-06-20T10:41:52.000Z","size":8,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-02T03:52:11.146Z","etag":null,"topics":["cradle","cradle-csrf","cradlephp","csrf","v1","v2"],"latest_commit_sha":null,"homepage":"http://cradlephp.github.io","language":"PHP","has_issues":false,"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/CradlePHP.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":"2018-03-12T03:52:35.000Z","updated_at":"2019-01-26T06:54:31.000Z","dependencies_parsed_at":"2022-08-21T09:50:23.378Z","dependency_job_id":null,"html_url":"https://github.com/CradlePHP/cradle-csrf","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CradlePHP%2Fcradle-csrf","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CradlePHP%2Fcradle-csrf/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CradlePHP%2Fcradle-csrf/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CradlePHP%2Fcradle-csrf/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CradlePHP","download_url":"https://codeload.github.com/CradlePHP/cradle-csrf/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245111946,"owners_count":20562512,"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":["cradle","cradle-csrf","cradlephp","csrf","v1","v2"],"created_at":"2024-11-30T13:08:32.081Z","updated_at":"2025-09-18T13:09:53.826Z","avatar_url":"https://github.com/CradlePHP.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# cradle-csrf\nCSRF helpers  \n\n## Install\n\n```\ncomposer require cradlephp/cradle-csrf\n```\n\nThen in `/bootstrap.php`, add\n\n```\n-\u003eregister('cradlephp/cradle-csrf')\n```\n\n## Usage\n\nIn any of your routes add the following code.\n\n```\ncradle()-\u003etrigger('csrf-load', $request, $response);\n```\n\nThe CSRF token will be found in `$request-\u003egetStage('csrf')`. In your form\ntemplate, be sure to add this key in a hidden field like the following.\n\n```\n\u003cinput name=\"csrf\" value=\"{{csrf}}\" /\u003e\n```\n\nWhen validating this form in a route you can use the following\n\n```\ncradle()-\u003etrigger('csrf-validate', $request, $response);\n```\n\nIf there is an error, it will be found in the response error object message.\nYou can check this using the following.\n\n```\nif($response-\u003eisError()) {\n    $message = $response-\u003egetMessage();\n    //report the error\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcradlephp%2Fcradle-csrf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcradlephp%2Fcradle-csrf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcradlephp%2Fcradle-csrf/lists"}