Download the PHP package altmetric/mongo-session-handler without Composer

On this page you can find all versions of the php package altmetric/mongo-session-handler. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package mongo-session-handler

THIS PROJECT IS DEPRECATED

mongo-session-handler is not maintained anymore.

Mongo Session Handler Build Status

A PHP session handler backed by MongoDB.

Current version: 2.1.0
Supported PHP versions: 5.4, 5.5, 5.6, 7

Note: This package depends on the MongoDB PHP driver extension (mongodb) and its companion PHP library. If you need to use the older, legacy driver (mongo), please see version 1.0.

Installation

Usage

API Documentation

public MongoSessionHandler::__construct(MongoDB\Collection $collection[, Psr\Log\LoggerInterface $logger])

Instantiate a new MongoDB session handler with the following arguments:

The given $collection will be populated with documents using the following schema:

This handler implements the SessionHandlerInterface meaning that it can be registered as a session handler with session_set_save_handler.

Expiring sessions

If you wish to clean up expired sessions using SessionHandlerInterface::gc, ensure that your session.gc_divisor, session.gc_probability and session.gc_maxlifetime settings are populated accordingly, e.g. the following settings in your php.ini mean that sessions that haven't been updated in over an hour have a 1% chance of being cleaned whenever someone starts a new session:

In order to keep session cleaning fast, you should add an index on the last_accessed field of your session $collection, e.g.

Concurrency

As MongoDB prior to 3.0 does not support document level locking, this session handler operates on a principle of Last Write Wins.

If a user of a session causes two simultaneous writes then you may end up with the following situation:

  1. Window A reads session value of ['foo' => 'bar'];
  2. Window B reads session value of ['foo' => 'bar'];
  3. Window B writes session value of ['foo' => 'baz'];
  4. Window A writes session value of ['foo' => 'quux'].

The session will now contain ['foo' => 'quux'] as it was the last successful write. This may be surprising if you're trying to increment some value in a session as it is not locked during reads and writes:

  1. Window A reads session value of ['count' => 0];
  2. Window B reads session value of ['count' => 0];
  3. Window B writes session value of ['count' => 1];
  4. Window A writes session value of ['count' => 1].

Acknowledgements

License

Copyright © 2015-2017 Altmetric LLP

Distributed under the MIT License.


All versions of mongo-session-handler with dependencies

PHP Build Version
Package Version
Requires php Version >= 5.4.0
ext-mongodb Version *
psr/log Version ^1.0
mongodb/mongodb Version ^1.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package altmetric/mongo-session-handler contains the following files

Loading the files please wait ....