PHPackages                             imarc/craft-dbsessions - 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. [Database &amp; ORM](/categories/database)
4. /
5. imarc/craft-dbsessions

ActiveCraft-plugin[Database &amp; ORM](/categories/database)

imarc/craft-dbsessions
======================

A database session handler specifically for Craft CMS

2.0.0(5y ago)2292MITPHP

Since Sep 22Pushed 5y ago3 watchersCompare

[ Source](https://github.com/imarc/craft-dbsessions)[ Packagist](https://packagist.org/packages/imarc/craft-dbsessions)[ Docs](https://github.com/imarc/craft-dbsessions)[ RSS](/packages/imarc-craft-dbsessions/feed)WikiDiscussions master Synced 3w ago

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

Craft DB Sessions Handler
=========================

[](#craft-db-sessions-handler)

For Craft 2.x. Sets up a database sesssion handler using Craft's existing DB and Caching libraries to ensure that only a single database connection is ever created.

This is not a true Craft plugin, but is best distributed as one.

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

[](#installation)

Install through composer (recommended):

```
composer require imarc/craft-dbsessions

```

Alternatively place all files into a `craft/plugins/dbsessions` directory.

Usage
-----

[](#usage)

Add the following at the very top of your `public/index.php` file:

```
require __DIR__ . '/../craft/plugins/dbsessions/SessionHandler.php';
\Imarc\CraftDatabaseSessions\SessionHandler::register();

```

Your sessions will now be stored in craft's database instead of on the filesystem.

The `dbsessions_sessions` database table used by this library *should* be created automatically. If there are restrictive database permissions, you can use the following migration to create the table manually:

```
CREATE TABLE dbsessions_sessions (
    id char(128) NOT NULL PRIMARY KEY,
    expire int(11) NULL,
    value longblob NULL
);

```

Why?
----

[](#why)

Sometimes, in an high-availability environment with multiple application servers, storing the sessions directly on the filesystem is not ideal as there is no consistency to which application server an end-user is hitting. **Redis or Memcached is recommended over using the DB for sessions** as Craft can work with those out of the box, but DB is fine if those services aren't available for whatever reason.

###  Health Score

30

—

LowBetter than 62% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity64

Established project with proven stability

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

Total

2

Last Release

2027d ago

Major Versions

1.0.0 → 2.0.02020-12-03

### Community

Maintainers

![](https://www.gravatar.com/avatar/00725533df5fd021ac93639028725bf46bef78f6d924618a987b9bfd5c32c3eb?d=identicon)[jeffturcotte](/maintainers/jeffturcotte)

![](https://www.gravatar.com/avatar/4c423d4aa457201693aadc0ffd67895f3383709e89c66547949d65a37123ee22?d=identicon)[khamer](/maintainers/khamer)

---

Top Contributors

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

### Embed Badge

![Health badge](/badges/imarc-craft-dbsessions/health.svg)

```
[![Health](https://phpackages.com/badges/imarc-craft-dbsessions/health.svg)](https://phpackages.com/packages/imarc-craft-dbsessions)
```

###  Alternatives

[helsingborg-stad/municipio

A bootstrap theme for creating municipality sites.

4028.3k10](/packages/helsingborg-stad-municipio)[stuttter/ludicrousdb

LudicrousDB is a database class that supports replication, failover, load balancing, &amp; partitioning, based on Automattic's HyperDB drop-in.

563121.6k](/packages/stuttter-ludicrousdb)[aaemnnosttv/wp-sqlite-db

SQLite drop-in database driver for WordPress

58465.3k5](/packages/aaemnnosttv-wp-sqlite-db)[andreyryabin/sprint.migration

bitrix migration module

207204.1k2](/packages/andreyryabin-sprintmigration)[pressbooks/pressbooks

Pressbooks is an open source book publishing tool built on a WordPress multisite platform. Pressbooks outputs books in multiple formats, including PDF, EPUB, web, and a variety of XML flavours, using a theming/templating system, driven by CSS.

45344.0k1](/packages/pressbooks-pressbooks)[humanmade/ludicrousdb

LudicrousDB is a database class that supports replication, failover, load balancing, &amp; partitioning, based on Automattic's HyperDB drop-in.

13215.8k6](/packages/humanmade-ludicrousdb)

PHPackages © 2026

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