PHPackages                             coercive/havelock - 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. coercive/havelock

ActiveLibrary[Security](/categories/security)

coercive/havelock
=================

Coercive Security Havelock

0.0.0(3y ago)138MITPHP &gt;=7.4

Since Feb 27Pushed 3y ago1 watchersCompare

[ Source](https://github.com/Coercive/Havelock)[ Packagist](https://packagist.org/packages/coercive/havelock)[ Docs](http://coercive.fr)[ RSS](/packages/coercive-havelock/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (2)Versions (2)Used By (0)

Coercive Havelock
=================

[](#coercive-havelock)

Experimental project: encrypted serialized data.

Get
---

[](#get)

```
composer require coercive/havelock

```

Usage
-----

[](#usage)

```
use Coercive\Security\Cookie\Cookie;
use Coercive\Security\Havelock\Havelock;

# Example of loading class Cookie
$crypt = 'exampleAbCdE12345';
$salt = 'example123';
$prefix = 'example_';
$cookie = (new Cookie($crypt, '/', '.domain.com', true, true))
                ->anonymize(true, $salt, $prefix);

# Example of loading class Havelock
$crypt = 'example1234567890ABCDEF';
$dir = '/www/secure/directory/havelock';
$havelock = new Havelock($crypt, $dir, $cookie);

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

# For the first time, the internal directories must be created
# You can use the absolute reinit function :
$havelock->kill();

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

# Initialize Havelock for the current user
$havelock->create();

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

# Load session and show data
$havelock->read();
var_dump($havelock->data());
var_dump($havelock->get('user'));
var_dump($havelock->get('token'));
var_dump($havelock->get('test'));

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

# Save data
$havelock->save([
    'user' => 123,
    'token' => 456,
    'test' => 'hello',
]);

# Or
$havelock->data([
    'user' => 123,
    'token' => 456,
    'test' => 'hello',
]);
$havelock->save();

# Or
$havelock->set('user', 123);
$havelock->set('token', 456);
$havelock->set('test', 'hello');
$havelock->save();

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

# If you do not use cookie, you can store registry keys elsewhere

# First, disable cookie
$havelock = new Havelock($crypt, $dir /* not insert Cookie class here */);
# OR
$havelock->cookie(false);

# Inject external registry keys
$keys = [
    'TEST_KEY_1' => 'xxxxxxxxxx',
    'TEST_KEY_2' => 'yyyyyyyyyy',
    'TEST_KEY_3' => 'zzzzzzzzzz'
];

$havelock->prefixKeys('TEST_KEY_');
$havelock->keys($keys);

# Expose internal registry keys
$keys = $havelock->keys();

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

# Refresh regstry tokens and cookies
$havelock->refresh();

# Delete current user session
$havelock->destroy();

# Delete all expired session
$havelock->offload();
```

###  Health Score

19

—

LowBetter than 10% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity35

Early-stage or recently created project

 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

Unknown

Total

1

Last Release

1175d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/20288080?v=4)[Coercive](/maintainers/Coercive)[@Coercive](https://github.com/Coercive)

---

Top Contributors

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

---

Tags

encryptphpsecuritysession

### Embed Badge

![Health badge](/badges/coercive-havelock/health.svg)

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

###  Alternatives

[paragonie/password_lock

Wraps Bcrypt-SHA2 in Authenticated Encryption

19348.7k1](/packages/paragonie-password-lock)[psecio/secure_dotenv

An encrypted environment configuration handler

11537.7k2](/packages/psecio-secure-dotenv)[thomaswelton/laravel-mcrypt-faker

Allows installation of Laravel where the PHP Mcrypt extension is not available. Provides encryption using OpenSSL, or by disabling encryption entierly.

113.8k](/packages/thomaswelton-laravel-mcrypt-faker)

PHPackages © 2026

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