Download the PHP package nitecon/zf2-db-session without Composer

On this page you can find all versions of the php package nitecon/zf2-db-session. 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 zf2-db-session

DBSessionStorage

Zend Framework Module for storing sessions in database.

Features

Setup

The following steps are necessary to get this module working

  1. Run php composer.phar require nitecon/zf2-db-session:1.*
  2. Add DBSessionStorage to the enabled modules list
  3. Add the sessions table to your database with:
    CREATE TABLE IF NOT EXISTS `sessions` (
        `id` char(32) NOT NULL DEFAULT '',
        `name` varchar(255) NOT NULL,
        `modified` int(11) DEFAULT NULL,
        `lifetime` int(11) DEFAULT NULL,
        `data` text,
        PRIMARY KEY (`id`)
      ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
      
  4. Copy vendor/nitecon/zf2-db-session/dbsession.global.php.dist to config/autoload/dbsession.global.php
  5. Configure the session options in config/autoload/dbsession.global.php

Addditional Information

This module assumes that you already have a top level db key in your configuration like the following:

    return array(
    'db' => array(
        'driver' => 'Pdo',
        'dsn' => 'mysql:dbname=somedb;host=localhost',
        'username' => 'sessionuser',
        'password' => 'sessionpass',
        'driver_options' => array(
            PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES \'UTF8\'',
            'buffer_results' => true
        ),
    ),
    /* Rest of your config */
    );

If you do not have this configuration please make sure to add it based on your database details, and always remember to put your username and password details in the local.php file so that it is not added to the revision control system that you use.

Gotchas and Errors

If you see the error that looks something like: Laminas\Session\SessionManager 'Insufficient data for unserializing' It means that the data being inserted into the database is larger than what the column allows for it.

To fix this issue adjust the 'data' column in your database from 'text' -> 'blob', On some of my applications that store a good amount of data in the session I've noticed that with some ZF2 overhead on the session they are generally around 1.5kb in size which generates this error.

Final notes

Please note that the driver as listed above does not need to be Pdo it can be anything that Zend Adapter supports, however it has only been tested with a Pdo / Mysqli driver.

I'm also planning on adding another module for doctrine based database interface in the future for those that are interested.

Enjoy and if you find bugs or issues please add pull requests for the module.


All versions of zf2-db-session with dependencies

PHP Build Version
Package Version
Requires php Version >=5.3.3
zendframework/zendframework Version 2.*
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 nitecon/zf2-db-session contains the following files

Loading the files please wait ...