PHPackages                             crazedsanity/dbsession - 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. crazedsanity/dbsession

ActiveLibrary[Database &amp; ORM](/categories/database)

crazedsanity/dbsession
======================

Library for handling web-based sessions, for all things Crazed(Sanity).

v0.1.3(8y ago)03622MITPHP

Since Aug 15Pushed 8y ago1 watchersCompare

[ Source](https://github.com/crazedsanity/dbsession)[ Packagist](https://packagist.org/packages/crazedsanity/dbsession)[ Docs](http://www.crazedsanity.com)[ RSS](/packages/crazedsanity-dbsession/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (3)Versions (5)Used By (2)

WARNING
=======

[](#warning)

This was ported from cs-webapplibs. This documentation needs to be updated. CS-Content may or may not be able to automatically use DBSession.

CS Session DB (cs\_sessionDB)
=============================

[](#cs-session-db-cs_sessiondb)

Session DB is used to store session information in a database instead of using files, and is an extension of [CS-Content](https://github.com/crazedsanity/cs-content). Using a database allows for simpler sharing of sessions across multiple servers (or at least a different way of doing so). It also allows for easy determination of how many sessions are anonymous versus logged-in.

How It Works
------------

[](#how-it-works)

If your web application is already using CS-Content, then integration is actually quite seamless: by adding a few constants to your web application code, Session DB will automatically begin storing session information into the database. In fact, it will even create the appropriate tables in the database (provided the database is PostgreSQL).

### Using Constants

[](#using-constants)

Assuming your website is already setup with CS-Content, there's just a few steps. In your main includes file (e.g. "lib/includes.php", or just somewhere that is always run prior to calling "new contentSystem()"), just add a couple of lines:

```
define('SESSION_DBSAVE', 1);
define('SESSION_DB_DSN', "pgsql:host=localhost;dbname=$dbname;port=$port");
define('SESSION_DB_USER', $dbUsername);
define('SESSION_DB_PASS', $dbPassword);
```

### Using Site Configuration File

[](#using-site-configuration-file)

Using the [Site Configuration system](https://github.com/crazedsanity/siteconfig), just add a few lines in your XML configuration file:

```

....

		...
		{WEBSITE/DB_DSN}
        {WEBSITE/DB_PG_DBUSER}
        {WEBSITE/DB_PG_DBPASS}

...

```

*NOTE: this assumes there's a "WEBSITE" section with "DB\_DSN", "DB\_PG\_DBUSER", and "DB\_PG\_DBPASS" tags.*

More Info...
------------

[](#more-info)

This system depends on the [included schema](setup/schema.pgsql.sql). This schema includes a user authentication table (for storing usernames, passwords, etc), logging info, and other required systems. Change the schema at your own peril. Note that currently, the only database that is technically supported is PostgreSQL.

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity56

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

Total

4

Last Release

3183d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/2e5c258da2d3360da7bc80c01e0a97ff96a036cef58f8a5434daf469ad7cc186?d=identicon)[crazedsanity](/maintainers/crazedsanity)

---

Top Contributors

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

---

Tags

phpdatabasesessiondryoaoo

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/crazedsanity-dbsession/health.svg)

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

###  Alternatives

[popphp/pop-db

Pop Db Component for Pop PHP Framework

1814.6k11](/packages/popphp-pop-db)[modul-is/orm

Lightweight hybrid ORM/Explorer

1118.1k](/packages/modul-is-orm)[jonas-elias/hyperf-oracle

A oracle handler for hyperf/database.

102.0k](/packages/jonas-elias-hyperf-oracle)

PHPackages © 2026

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