https://github.com/pardnio/php-session-fallback
(PHP Library) Session manager with graceful fallback
https://github.com/pardnio/php-session-fallback
backend pardnchiu php session
Last synced: about 1 month ago
JSON representation
(PHP Library) Session manager with graceful fallback
- Host: GitHub
- URL: https://github.com/pardnio/php-session-fallback
- Owner: pardnio
- License: mit
- Created: 2025-02-02T20:54:57.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-02-03T08:26:53.000Z (over 1 year ago)
- Last Synced: 2026-04-24T17:35:29.573Z (about 2 months ago)
- Topics: backend, pardnchiu, php, session
- Language: PHP
- Homepage:
- Size: 5.86 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# PD\Session
> PD\Session is a flexible PHP session manager with Redis support and filesystem fallback. Provides secure session handling.




## 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
- 7-day session lifetime
- Automatic garbage collection
- Session ID regeneration support
- Secure storage handling
- System resilience fallback mechanism
## Dependencies
- `pardnchiu/redis` - For Redis caching support (optional)
- `/storage/sessions` - Write permission required for storage directory
## How to Use
### Installation
```shell
composer require pardnchiu/session
```
```php
// 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
This source code project is licensed under the [MIT](https://github.com/pardnchiu/PHP-Session/blob/main/LICENSE) license.
## Creator

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