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 yesterday

READMEChangelog (3)Dependencies (1)Versions (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

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity49

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

1930d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/dc2ab5849a75fc3ee5bb8399326971a64b7da68511adb149d2225c632e6daa6a?d=identicon)[tkirsch](/maintainers/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

[defuse/php-encryption

Secure PHP Encryption Library

3.9k162.4M214](/packages/defuse-php-encryption)[roave/security-advisories

Prevents installation of composer packages with known security vulnerabilities: no API, simply require it

2.9k97.3M6.4k](/packages/roave-security-advisories)[mews/purifier

Laravel 5/6/7/8/9/10 HtmlPurifier Package

2.0k16.7M113](/packages/mews-purifier)[robrichards/xmlseclibs

A PHP library for XML Security

41278.1M118](/packages/robrichards-xmlseclibs)[bjeavons/zxcvbn-php

Realistic password strength estimation PHP library based on Zxcvbn JS

86917.5M63](/packages/bjeavons-zxcvbn-php)[illuminate/encryption

The Illuminate Encryption package.

9229.7M280](/packages/illuminate-encryption)

PHPackages © 2026

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