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 3w ago

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 21% 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

1984d 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

[mews/purifier

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

2.0k18.7M143](/packages/mews-purifier)[codeigniter4/appstarter

CodeIgniter4 starter app

1791.8M](/packages/codeigniter4-appstarter)[paragonie/ecc

PHP Elliptic Curve Cryptography library

24820.0k38](/packages/paragonie-ecc)[abydahana/aksara

Aksara is a CodeIgniter based CRUD Toolkit you can use to build complex applications become shorter, secure and more reliable just in a few lines of code. Serving both CMS or Framework, produce both HEADLESS (RESTful API) or TRADITIONAL (Browser Based), just by writing single controller. Yet it's reusable, scalable and ready to use!

1111.2k](/packages/abydahana-aksara)[maniaba/asset-connect

AssetConnect is a file management library for CodeIgniter 4 that allows you to associate files with any entity in your application

1015.3k](/packages/maniaba-asset-connect)

PHPackages © 2026

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