PHPackages                             lukeelten/cakephp-encrypted-session - 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. lukeelten/cakephp-encrypted-session

ActiveCakephp-plugin[Security](/categories/security)

lukeelten/cakephp-encrypted-session
===================================

Encrypted Session Middleware which encrypts the session on server-side with a per-user key.

1.0.5(6y ago)1480MITPHPPHP &gt;=7.1CI failing

Since Apr 24Pushed 6y ago1 watchersCompare

[ Source](https://github.com/lukeelten/cakephp-encrypted-session)[ Packagist](https://packagist.org/packages/lukeelten/cakephp-encrypted-session)[ RSS](/packages/lukeelten-cakephp-encrypted-session/feed)WikiDiscussions master Synced today

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

CakePHP Session Encryption
==========================

[](#cakephp-session-encryption)

This is a CakePHP Plugin which encrypts a user's session data transparently before storing it. The session data will be automatically decrypted during the next request.

Why do I need this?
-------------------

[](#why-do-i-need-this)

The new GDPR regulation does not enforce encryption on personal data, nevertheless it is recommended to encrypt personal data everywhere, especially at rest. A saved session is simply data stored at rest.

Due to user authorization or other application features, the session often contains data which can be classified as personal data according to the GDPR. Therefore encrypting them is a reasonable safety measure to prevent data breaches.

To increase security, a unique encryption key is generated for each user and stored into a cookie. Keeping the key away from the server, makes decrypting all of the session data at once a very hard task.

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

[](#installation)

Install plugin using [composer](http://getcomposer.org):

```
composer require lukeelten/cakephp-encrypted-session
```

The plugin does not need any loading during bootstrap.

Configuration
-------------

[](#configuration)

There are several options to configure the behavior, nevertheless the plugin contains a useful set of default values so you **do not need any configuration at all**.

Nevertheless, it is recommended to configure at least an encryption salt, otherwise *Security.salt* will be used.

Possible options to add to application config:

```
'Session' => [
    "Encryption" => [
        "salt" => getenv("SESSION_SALT", "default-salt"), // Server side salt; fill in random string
        "cookieName" => "CAKE_SESSION_KEY", // Cookie name
        "expire" => strtotime("+1 year"), // Default cookie lifetime
        "secure" => false, // Use with https only
        "path" => "/" // Cookie path
    ]
]
```

Usage
-----

[](#usage)

Simply add the middleware to your Application middleware setup (Application.php)

```
$middleware->add(new EncryptedSessionMiddleware());
```

### Important Note:

[](#important-note)

If this middleware is used in combination with *EncryptedCookieMiddleware* and you want to encrypt the session key cookie as well, you must ensure, that the *EncryptedCookieMiddleware* is loaded into the middleware chain **BEFORE** the *EncryptedSessionMiddleware*.

```
$middleware->add(new EncryptedCookieMiddleware())
    ->add(new EncryptedSessionMiddleware());
```

###  Health Score

29

—

LowBetter than 57% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 50% 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 ~117 days

Recently: every ~147 days

Total

6

Last Release

2400d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/513392?v=4)[Tobias Derksen](/maintainers/lukeelten)[@lukeelten](https://github.com/lukeelten)

---

Top Contributors

[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (1 commits)")[![lukeelten](https://avatars.githubusercontent.com/u/513392?v=4)](https://github.com/lukeelten "lukeelten (1 commits)")

---

Tags

encryptioncakephpsession

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/lukeelten-cakephp-encrypted-session/health.svg)

```
[![Health](https://phpackages.com/badges/lukeelten-cakephp-encrypted-session/health.svg)](https://phpackages.com/packages/lukeelten-cakephp-encrypted-session)
```

###  Alternatives

[cakephp/bake

Bake plugin for CakePHP

11211.7M190](/packages/cakephp-bake)[dereuromark/cakephp-tools

A CakePHP plugin containing lots of useful and reusable tools

333972.2k49](/packages/dereuromark-cakephp-tools)[dereuromark/cakephp-queue

The Queue plugin for CakePHP provides deferred task execution.

308914.0k25](/packages/dereuromark-cakephp-queue)[dereuromark/cakephp-ide-helper

CakePHP IdeHelper Plugin to improve auto-completion

1882.3M40](/packages/dereuromark-cakephp-ide-helper)[dereuromark/cakephp-tinyauth

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

131237.3k13](/packages/dereuromark-cakephp-tinyauth)[dereuromark/cakephp-setup

A CakePHP plugin containing lots of useful management tools

35184.7k2](/packages/dereuromark-cakephp-setup)

PHPackages © 2026

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