PHPackages                             rubyan/cake3-cookieauth - 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. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. rubyan/cake3-cookieauth

ActiveCakephp-plugin[Authentication &amp; Authorization](/categories/authentication)

rubyan/cake3-cookieauth
=======================

A simple Cake3 plugin to authenticate users with Cookies.

3.7.1(7y ago)110.5kMITPHPPHP &gt;=5.4.16

Since Nov 5Pushed 7y ago1 watchersCompare

[ Source](https://github.com/Rubyan/Cake3-CookieAuth)[ Packagist](https://packagist.org/packages/rubyan/cake3-cookieauth)[ Docs](https://github.com/rubyan/Cake3-CookieAuth)[ RSS](/packages/rubyan-cake3-cookieauth/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependencies (3)Versions (10)Used By (0)

Cake3 CookieAuth
================

[](#cake3-cookieauth)

A simple Cake3 plugin to authenticate users with Cookies. This plugin is based on the awesome plugin [Xety/Cake3-Cookieauth](https://github.com/Xety/Cake3-CookieAuth) but with an option to allow empty passwords. It has also been fixed for CakePHP 3.7

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

[](#requirements)

- CakePHP 3.X

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

[](#installation)

Run : `composer require rubyan/cake3-cookieauth:1.*`Or add it in your `composer.json`:

```
"require": {
	"rubyan/cake3-cookieauth": "1.*"
},
```

Usage
-----

[](#usage)

In your `config/bootstrap.php` add :

```
Plugin::load('Xety/Cake3CookieAuth');
```

In your `AppController` :

```
public $components = [
	'Cookie',
	'Auth' => [
		'authenticate' => [
			'Form',
			'Xety/Cake3CookieAuth.Cookie'
		]
	]

];
```

In your `AppController`, in the `beforeFilter` action :

```
public function beforeFilter(Event $event) {
	//Automaticaly Login.
	if (!$this->Auth->user() && $this->Cookie->read('CookieAuth')) {

		$user = $this->Auth->identify();
		if ($user) {
			$this->Auth->setUser($user);
		} else {
			$this->Cookie->delete('CookieAuth');
		}
	}
}

//If you want to update some fields, like the last_login_date, or last_login_ip, just do :
public function beforeFilter(Event $event) {
	//Automaticaly Login.
	if (!$this->Auth->user() && $this->Cookie->read('CookieAuth')) {
		$this->loadModel('Users');

		$user = $this->Auth->identify();
		if ($user) {
			$this->Auth->setUser($user);

			$user = $this->Users->newEntity($user);
			$user->isNew(false);

			//Last login date
			$user->last_login = new Time();
			//Last login IP
			$user->last_login_ip = $this->request->clientIp();
			//etc...

			$this->Users->save($user);
		} else {
			$this->Cookie->delete('CookieAuth');
		}
	}
}
```

In your `login` action, after `$this->Auth->setUser($user);` :

```
//It will write Cookie without RememberMe checkbox
$this->Cookie->configKey('CookieAuth', [
	'expires' => '+1 year',
	'httpOnly' => true
]);
$this->Cookie->write('CookieAuth', [
	'username' => $this->request->data('username'),
	'password' => $this->request->data('password')
]);

//If you want use a RememberMe checkbox in your form :
//In your view
echo $this->Form->checkbox('remember_me');

//In the login action :
if($this->request->data('remember_me')) {
	$this->Cookie->configKey('CookieAuth', [
		'expires' => '+1 year',
		'httpOnly' => true
	]);
	$this->Cookie->write('CookieAuth', [
		'username' => $this->request->data('username'),
		'password' => $this->request->data('password')
	]);
}
```

If you use LDAP for authentication you don't want to store the password obviously. You can set the password to null when writing the cookie.

```
	$this->Cookie->write('CookieAuth', [
		'username' => $this->request->data('username'),
		'password' => null
	]);
```

Contribute
----------

[](#contribute)

[Follow this guide to contribute](https://github.com/Xety/Cake3-CookieAuth/blob/master/CONTRIBUTING.md)

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

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 ~251 days

Recently: every ~340 days

Total

7

Last Release

2702d ago

Major Versions

v1.3 → 3.62018-12-18

PHP version history (2 changes)v1.0PHP &gt;=5.4.0

v1.3PHP &gt;=5.4.16

### Community

Maintainers

![](https://www.gravatar.com/avatar/bc494dcb0d4ccce9c96be549656da5eb15eb094deac3a1eefca61ec18768a2bf?d=identicon)[rubyan](/maintainers/rubyan)

---

Top Contributors

[![Xety](https://avatars.githubusercontent.com/u/8210023?v=4)](https://github.com/Xety "Xety (6 commits)")[![johanvanderkuijl](https://avatars.githubusercontent.com/u/1000115?v=4)](https://github.com/johanvanderkuijl "johanvanderkuijl (5 commits)")[![antograssiot](https://avatars.githubusercontent.com/u/4977112?v=4)](https://github.com/antograssiot "antograssiot (1 commits)")[![icaroscherma](https://avatars.githubusercontent.com/u/42467?v=4)](https://github.com/icaroscherma "icaroscherma (1 commits)")

---

Tags

pluginauthcakephplogincookieauthenticatecake3

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/rubyan-cake3-cookieauth/health.svg)

```
[![Health](https://phpackages.com/badges/rubyan-cake3-cookieauth/health.svg)](https://phpackages.com/packages/rubyan-cake3-cookieauth)
```

###  Alternatives

[xety/cake3-cookieauth

A simple Cake3 plugin to authenticate users with Cookies.

1954.7k2](/packages/xety-cake3-cookieauth)[dereuromark/cakephp-tinyauth

A CakePHP plugin to handle user authentication and authorization the easy way.

129228.6k10](/packages/dereuromark-cakephp-tinyauth)[ivanamat/cakephp3-aclmanager

AclManager plugin for CakePHP 3.x

2715.2k](/packages/ivanamat-cakephp3-aclmanager)

PHPackages © 2026

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