PHPackages                             pardnchiu/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. [Utility &amp; Helpers](/categories/utility)
4. /
5. pardnchiu/session

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

pardnchiu/session
=================

PD\\Session is a flexible PHP session manager with Redis support and filesystem fallback. Provides secure session handling.

1.0.0(1y ago)19MITPHPPHP &gt;=8.0

Since Feb 2Pushed 1y ago1 watchersCompare

[ Source](https://github.com/pardnchiu/PHP-Session)[ Packagist](https://packagist.org/packages/pardnchiu/session)[ RSS](/packages/pardnchiu-session/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)DependenciesVersions (2)Used By (0)

PD\\Session
===========

[](#pdsession)

> PD\\Session is a flexible PHP session manager with Redis support and filesystem fallback. Provides secure session handling.

[![tag](https://camo.githubusercontent.com/07d4775f9a428b29d7f341b0104590f95096d5f18eba51e4087d9c4d528f99d7/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7461672d5048502532304c6962726172792d626234343434)](https://camo.githubusercontent.com/07d4775f9a428b29d7f341b0104590f95096d5f18eba51e4087d9c4d528f99d7/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7461672d5048502532304c6962726172792d626234343434)[![size](https://camo.githubusercontent.com/514fef0bc69e8b112715e275150a78099d4ed950d373621df78254c2f95e14bd/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73697a652f706172646e636869752f5048502d53657373696f6e2f7372632f53657373696f6e2e706870)](https://camo.githubusercontent.com/514fef0bc69e8b112715e275150a78099d4ed950d373621df78254c2f95e14bd/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73697a652f706172646e636869752f5048502d53657373696f6e2f7372632f53657373696f6e2e706870)
[![version](https://camo.githubusercontent.com/7b5659fb35c229d23b0c3ef852b0f1334cfaa3cf4d16e750362d9e77ab51e2be/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f706172646e636869752f73657373696f6e)](https://camo.githubusercontent.com/7b5659fb35c229d23b0c3ef852b0f1334cfaa3cf4d16e750362d9e77ab51e2be/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f706172646e636869752f73657373696f6e)[![download](https://camo.githubusercontent.com/74334ed0fae2046cfedadfa06da56d0ed81f32481e4b9343ec3b062ca088e7ae/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646d2f706172646e636869752f73657373696f6e)](https://camo.githubusercontent.com/74334ed0fae2046cfedadfa06da56d0ed81f32481e4b9343ec3b062ca088e7ae/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646d2f706172646e636869752f73657373696f6e)

Features
--------

[](#features)

- Dual storage support (Redis / Filesystem)
- Automatic fallback mechanism
- Session security enhancements
- Built-in session lifetime management
- Session ID regeneration
- Creation time tracking

Security Features
-----------------

[](#security-features)

- 7-day session lifetime
- Automatic garbage collection
- Session ID regeneration support
- Secure storage handling
- System resilience fallback mechanism

Dependencies
------------

[](#dependencies)

- `pardnchiu/redis` - For Redis caching support (optional)
- `/storage/sessions` - Write permission required for storage directory

How to Use
----------

[](#how-to-use)

### Installation

[](#installation)

```
composer require pardnchiu/session
```

```
// Initialize with Redis support
$redis = new PD\Redis();
$session = new PD\Session($redis);

// Basic session operations
$session->set("user_id", 123);
$userId = $session->get("user_id");
$session->delete("user_id");

// Security operations
$session->regenerateId();   // Regenerate session ID
$session->destroy();        // Destroy session

// Session information
$sessionId = $session->getId();
$createdTime = $session->getCreatedTime();

// Initialize without Redis (filesystem only)
$session = new PD\Session();
```

License
-------

[](#license)

This source code project is licensed under the [MIT](https://github.com/pardnchiu/PHP-Session/blob/main/LICENSE) license.

Creator
-------

[](#creator)

[![](https://avatars.githubusercontent.com/u/25631760)](https://avatars.githubusercontent.com/u/25631760)

#### Pardn Chiu

[](#pardn-chiu)

[ ![](https://camo.githubusercontent.com/e4e01ee8def1b738dccf7d9ae9b80b137ddbfb3620b6cd2252a085691d2aa44b/68747470733a2f2f706172646e2e696f2f696d6167652f656d61696c2e737667)](mailto:dev@pardn.io)[ ![](https://camo.githubusercontent.com/3005d0110354f5144ff35f72d9e23c4df3cedf99365160c6c307236e8fc4d189/68747470733a2f2f706172646e2e696f2f696d6167652f6c696e6b6564696e2e737667)](https://linkedin.com/in/pardnchiu)---

©️ 2024 [Pardn Chiu](https://pardn.io)

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance42

Moderate activity, may be stable

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity43

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

Unknown

Total

1

Last Release

470d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/49e43b8311782f6fedf52a06a0e29d2a85c9e5277f146ec0f2293f3439858b14?d=identicon)[pardnchiu](/maintainers/pardnchiu)

---

Top Contributors

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

---

Tags

backendpardnchiuphpsession

### Embed Badge

![Health badge](/badges/pardnchiu-session/health.svg)

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

PHPackages © 2026

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