https://github.com/slimdestro/dual-session-logger-php-slimdestro
Dual Session Logger - PHP
https://github.com/slimdestro/dual-session-logger-php-slimdestro
dual-session-php php php-library php-session php7 session-management
Last synced: about 1 year ago
JSON representation
Dual Session Logger - PHP
- Host: GitHub
- URL: https://github.com/slimdestro/dual-session-logger-php-slimdestro
- Owner: slimdestro
- Created: 2024-01-13T07:40:24.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-01-14T13:08:35.000Z (over 2 years ago)
- Last Synced: 2024-01-14T23:28:40.986Z (over 2 years ago)
- Topics: dual-session-php, php, php-library, php-session, php7, session-management
- Language: PHP
- Homepage: https://modcode.dev
- Size: 3.91 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Dual Session Logger - PHP
#### This class logs session data($_SESSION["key"] = $val) into both database and File ###
## Setup
```sh
require_once('./DualSessionLogger.php');
$db = new PDO('your_db_details_here');
$DualSessionLogger = new DualSessionLogger($db, 'dual_session_table_name(optional)');
```
## Now bind this class with to session handler of native PHP
```sh
session_set_save_handler($DualSessionLogger, true);
```
## Now the data you save in session using $_SESSION[] will save in both Database and File
```sh
session_start();
$_SESSION["db_file_session_key"] = "db+file_value";
```
## To verify if this class is really working, you can try like this:
```sh
if (isset($_SESSION["db_file_session_key"])){
echo "Value=> " . $_SESSION["db_file_session_key"];
} else {
echo "Didnt work";
}
```
## Author
[Checkout my Website](https://modcode.dev)