PHPackages                             tomkirsch/samesite - 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. tomkirsch/samesite

ActiveLibrary[Security](/categories/security)

tomkirsch/samesite
==================

SameSite cookies for CI4

1.0.3(5y ago)012MITPHPPHP &gt;=7.2

Since Jan 27Pushed 5y ago1 watchersCompare

[ Source](https://github.com/tomkirsch/ci4-samesite)[ Packagist](https://packagist.org/packages/tomkirsch/samesite)[ RSS](/packages/tomkirsch-samesite/feed)WikiDiscussions master Synced today

READMEChangelog (3)DependenciesVersions (3)Used By (0)

NOTE!
=====

[](#note)

Samesite is only supported in PHP &gt; 7.3.0! If you are running an earlier version, this lib won't break anything, but samesite WON'T BET SET.

For older PHP versions, add this as the LAST item in your .htaccess rewrites:

```

	.
	.
	.
	# SameSite cookie - ensure this comes AFTER your rewrites!
	Header always edit Set-Cookie (.*) "$1; SameSite=Lax"

```

To control the samesite value, you'd need to add logic to your .htaccess file.

Installation
============

[](#installation)

Set the response class in `App\Config\Services`:

```
	public static function response(App $config = null, bool $getShared = true){
		if ($getShared) return static::getSharedInstance('response', $config);
		if (!is_object($config)) $config = config(App::class);
		return new \Tomkirsch\Samesite\SamesiteResponse($config);
	}

```

Now you can specify a different setting with $response-&gt;setCookie():

```
$this->response->setCookie('foo', 'bar', 60 * 60 * 24, '/', '', FALSE, FALSE, 'Strict');
or
$this->response->setCookie([
	'name'=>'foo',
	'value'=>'bar',
	'samesite'=>'Strict',
]);

```

(optional) If you'd like the default samesite to be something other than Lax, you can add this to the cookie section of `App\Config\App`:

```
public $cookieSameSite = 'Lax';

```

One more thing... don't use setcookie() directly!

###  Health Score

23

—

LowBetter than 25% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

2

Last Release

2029d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/362359?v=4)[Thomas Kirsch](/maintainers/tkirsch)[@tkirsch](https://github.com/tkirsch)

---

Top Contributors

[![tomkirsch](https://avatars.githubusercontent.com/u/36715955?v=4)](https://github.com/tomkirsch "tomkirsch (4 commits)")

### Embed Badge

![Health badge](/badges/tomkirsch-samesite/health.svg)

```
[![Health](https://phpackages.com/badges/tomkirsch-samesite/health.svg)](https://phpackages.com/packages/tomkirsch-samesite)
```

###  Alternatives

[phpids/phpids

PHPIDS (PHP-Intrusion Detection System) is a simple to use, well structured, fast and state-of-the-art security layer for your PHP based web application

791150.0k2](/packages/phpids-phpids)[paragonie/ecc

PHP Elliptic Curve Cryptography library

25866.3k44](/packages/paragonie-ecc)[nicobleiler/php-passphrase

Passphrase generator with Laravel integration, inspired by Bitwarden. Uses the EFF long word list by default with support for custom wordlists.

4912.6k](/packages/nicobleiler-php-passphrase)[dwgebler/encryption

Encryption wrapper for PHP using libsodium — simple API for symmetric and asymmetric encryption, password hashing, digital signing, and message authentication.

317.5k](/packages/dwgebler-encryption)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
