slim/csrf
Slim Framework 4 CSRF protection PSR-15 middleware
1.5.1
2.2M downloads/mo
#4315 most downloaded on Packagist
slimphp/Slim-Csrf
What this package is like to depend on
Last release 9 months ago
02 Nov 2025
Release timing varies
gaps range from 1 weeks to 1.8 years
Some releases are documented
notes for 12 of 22 stable releases
Nothing withdrawn
no release was ever pulled
11 years old
22 releases · first in 2015
1 release in the last 12 months
see the full history below
Release timeline
22 releases · Mar 2015 to Nov 2025Releases
latest 22-
1.5.102 Nov 2025Release notes
Open source → -
1.5.008 Jun 2024Release notes
Open source →What's Changed
- Bump psr/http-message requirement from '^1.0' to '^1.0 || ^2.0' by @odan in #184
- Support PHP 8.2 and 8.3 by @akrabat in #177
New Contributors
Full Changelog: 1.4.0...1.5.0
Release notes
Open source →- Added: Support for PHP 8.2 and 8.3
- Added: Support for psr/http-message 2.0 in addition to 1.0
-
1.4.022 Jan 2024Release notes
Open source →What's Changed
- Update phpspec/prophecy requirement from ^1.15 to ^1.16 by @dependabot in #167
- Update phpspec/prophecy requirement from ^1.16 to ^1.17 by @dependabot in #169
- Update phpunit/phpunit requirement from ^9.5 to ^9.6 by @dependabot in #170
- Update phpspec/prophecy-phpunit requirement from ^2.0 to ^2.1 by @dependabot in #172
- Update squizlabs/php_codesniffer requirement from ^3.7 to ^3.8 by @dependabot in #173
- Update phpspec/prophecy requirement from ^1.17 to ^1.18 by @dependabot in #174
- Allow tokens via header by @blizzz in #175
New Contributors
Full Changelog: 1.3.0...1.4.0
-
1.3.005 Nov 2022Release notes
Open source →Total issues resolved: 13
- 133: Upgrade to GitHub-native Dependabot thanks to @dependabot-preview[bot]
- 134: Update phpspec/prophecy requirement from ^1.12 to ^1.13 thanks to @dependabot[bot]
- 135: Update squizlabs/php_codesniffer requirement from ^3.5.8 to ^3.6.0 thanks to @dependabot[bot]
- 137: Update phpspec/prophecy requirement from ^1.13 to ^1.14 thanks to @dependabot[bot]
- 138: Add github actions workflow thanks to @l0gicgate
- 140: Bug in enforcing storage limit, grew too large in many cases. thanks to @deployHuman
- 141: Update squizlabs/php_codesniffer requirement from ^3.6.0 to ^3.6.1 thanks to @dependabot[bot]
- 144: PSR-12 thanks to @t0mmy742
- 145: Add XOR to token to avoid BREACH attack thanks to @t0mmy742
- 146: Update phpspec/prophecy requirement from ^1.14 to ^1.15 thanks to @dependabot[bot]
- 147: Drop Support for PHP 7.3 thanks to @nbayramberdiyev
- 162: Update squizlabs/php_codesniffer requirement from ^3.6 to ^3.7 thanks to @dependabot[bot]
- 165: Bug fix: Enforce storage limit on failure thanks to @akrabat
Release notes
Open source →- Added: Support for PSR-12
- Added: Add XOR to token to avoid BREACH attack
- Change: PHP 7.3 is no longer supported
-
1.2.104 Feb 2021Release notes
Open source →This release makes using an Interator for the backing storage much better.
Total issues resolved: 3
-
1.2.018 Jan 2021 -
1.1.008 Jan 2021Release notes
Open source →Note that this release includes a fix for replay attacks when using Slim-Csrf in non-persistent mode. Upgrading to this version is recommended.
Total issues resolved: 10
- 108: Minor code comment correction thanks to @iamrameffort
- 112: Update .travis.yml thanks to @sergiy-petrov
- 115: Make remoteTokenFromStorage method public thanks to @l0gicgate
- 116: Minor improvements in code complexity with early returns and early validation thanks to @Ayesh
- 119: Update phpspec/prophecy requirement from ^1.8 to ^1.10 thanks to @dependabot-preview[bot]
- 120: Update squizlabs/php_codesniffer requirement from ^3.4.2 to ^3.5.5 thanks to @dependabot-preview[bot]
- 122: Update squizlabs/php_codesniffer requirement from ^3.5.5 to ^3.5.6 thanks to @dependabot-preview[bot]
- 123: Update squizlabs/php_codesniffer requirement from ^3.5.6 to ^3.5.8 thanks to @dependabot-preview[bot]
- 126: Remove token on validation to prevent replay attacks thanks to @akrabat
- 127: Raise error if there is a token in the body of a GET request thanks to @akrabat
Release notes
Open source →- Changed:
remoteTokenFromStorage()is now public - Changed: Don't allow token in the body of a GET request
- Fixed: Prevent replay attack by removing token on valdiation
-
1.0.013 Sep 2019 -
0.8.322 Aug 2018 -
0.8.214 Oct 2017 -
0.8.120 Dec 2016 -
0.8.006 Dec 2016Release notes
Open source →-
Added: Now supports "persistence mode", to persist a single CSRF name/value pair throughout the life of a user's session. Added the following methods:
protected getLastKeyPair- gets the most recently generated key/value pair from storage.protected loadLastKeyPair- gets the most recently generated key/value pair from storage, and assign it to$this->keyPair.public setPersistentTokenModepublic getPersistentTokenMode
Note that if CSRF token validation fails, then the token should be renewed regardless of the persistence setting.
The methods
getTokenNameandgetTokenValuenow returnnullif$this->keyPairhas not yet been set.
-
-
0.7.008 Jun 2016Nothing published for this version
-
0.6.022 Dec 2015Nothing published for this version
-
0.5.009 Nov 2015Nothing published for this version
-
0.4.004 Sep 2015Nothing published for this version
-
0.3.318 Aug 2015Nothing published for this version
-
0.3.217 Aug 2015Nothing published for this version
-
0.3.116 Aug 2015Nothing published for this version
-
0.3.016 Aug 2015Nothing published for this version
-
0.2.016 Aug 2015Nothing published for this version
-
0.1.031 Mar 2015Nothing published for this version