PHPackages                             hkvstore/samesite-cookie - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Security](/categories/security)
4. /
5. hkvstore/samesite-cookie

ActiveLibrary[Security](/categories/security)

hkvstore/samesite-cookie
========================

Secure your site with SameSite cookies

0.3.5(2y ago)035.2k↓13.3%MITPHPPHP ^8.0

Since Apr 18Pushed 2y agoCompare

[ Source](https://github.com/hkvstore/samesite-cookie)[ Packagist](https://packagist.org/packages/hkvstore/samesite-cookie)[ Docs](https://github.com/selective-php/samesite-cookie)[ RSS](/packages/hkvstore-samesite-cookie/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (5)Dependencies (10)Versions (6)Used By (0)

selective/samesite-cookie
=========================

[](#selectivesamesite-cookie)

A PSR-15 middleware to secure your site with SameSite cookies 🍪

[![Latest Version on Packagist](https://camo.githubusercontent.com/972cdb2c52068898f778df5f50917cf50ace9a0f395574ff32e967454b0804bc/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f73656c6563746976652d7068702f73616d65736974652d636f6f6b69652e737667)](https://packagist.org/packages/selective/samesite-cookie)[![Software License](https://camo.githubusercontent.com/074b89bca64d3edc93a1db6c7e3b1636b874540ba91d66367c0e5e354c56d0ea/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e737667)](LICENSE)[![Build Status](https://github.com/selective-php/samesite-cookie/workflows/build/badge.svg)](https://github.com/selective-php/samesite-cookie/actions)[![Coverage Status](https://camo.githubusercontent.com/8ee0920425fd81ba48913f75f0a50f3e170b1b8a90be06ccbb4ccb9712a8036d/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f73656c6563746976652d7068702f73616d65736974652d636f6f6b69652e737667)](https://scrutinizer-ci.com/g/selective-php/samesite-cookie/code-structure)[![Quality Score](https://camo.githubusercontent.com/b4db7e4cbcff4c17a12276ed54b52a143d0478a3c522e5134ee4a289736e2404/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f7175616c6974792f672f73656c6563746976652d7068702f73616d65736974652d636f6f6b69652e737667)](https://scrutinizer-ci.com/g/selective-php/samesite-cookie/?branch=master)[![Total Downloads](https://camo.githubusercontent.com/08c4d31e7f258572f176750d5d587149b5972e7a36515c9d0ebb203b0646d40c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f73656c6563746976652f73616d65736974652d636f6f6b69652e737667)](https://packagist.org/packages/selective/samesite-cookie/stats)

Requirements
------------

[](#requirements)

- PHP 8.0+

Installation
------------

[](#installation)

```
composer require selective/samesite-cookie

```

SameSite cookies
----------------

[](#samesite-cookies)

[![image](https://user-images.githubusercontent.com/781074/64995066-95404c80-d8da-11e9-975f-bdbbf55bd311.png)](https://user-images.githubusercontent.com/781074/64995066-95404c80-d8da-11e9-975f-bdbbf55bd311.png)

Same-site cookies ("First-Party-Only" or "First-Party") allow servers to mitigate the risk of CSRF and information leakage attacks by asserting that a particular cookie should only be sent with requests initiated from the same registrable domain.

**Warning:** SameSite cookies doesn't work at all for old Browsers and also not for some Mobil Browsers e.g. IE 10, Blackberry, Opera Mini, IE Mobile, UC Browser for Android.

Further details can be found here:

- [SameSite cookies explained](https://web.dev/samesite-cookies-explained)
- [CSRF is (really) dead](https://scotthelme.co.uk/csrf-is-really-dead/)
- [PHP setcookie “SameSite=Strict”?](https://stackoverflow.com/questions/39750906/php-setcookie-samesite-strict)
- [How to Set a cookie attribute Samesite value in PHP ?](https://www.tutorialshore.com/how-to-set-a-cookie-attribute-samesite-value-in-php/)
- [Can I use SameSite?](https://caniuse.com/#feat=same-site-cookie-attribute)

Slim 4 integration
------------------

[](#slim-4-integration)

```
