Skip to content
This repository has been archived by the owner on Feb 9, 2022. It is now read-only.

mostlygeek/MongoSession

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

41 Commits
 
 
 
 
 
 
 
 

Repository files navigation

PHP Mongo Session Driver

About

  • PHP Sessions stored within MongoDB.
  • Supports session locking so it is safe to use with AJAX apps.
  • Super duper easy to use.

This library is based on work originally from halfdan/MongoSession.

Usage


<?php
require_once('./MongoSessionHandler.php');
MongoSessionHandler::register('session', 'session'); // db and collection
?>

By default MongoSessionHandler will connect to MongoDB running on localhost. To set up a custom environment that uses many servers do this:


<?php
require_once('./MongoSessionHandler.php');
$conf = array(
    // list of servers
    'servers' => array('mongo1:27017', 'mongo2:27017', 'mongo3:27017'),

    // options for connection
    'options' => array(
        'persist' => 'mongo-session',
        'replicaSet' => true
    )
);
MongoSessionHandler::register('session', 'session', $conf);
?>

When in doubt, read the code. Most of it is locking code and license comment anyways. :)

License

It’s MIT licensed.

About

A PHP session handler wrapped using MongoDB.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • PHP 100.0%