jlaso/session-storage-bundle

用于为PDOSessionHandler创建表的层

dev-master 2018-11-14 20:35 UTC

This package is auto-updated.

Last update: 2024-09-15 10:27:54 UTC


README

Latest Stable Version Total Downloads Latest Unstable Version License

======== 概述

此bundle创建了PDOSessionHandler所需表

为了安装此bundle,您需要注意要求

php > 5.3.7

安装

检出代码副本

// in composer.json
"require": {
    // ...
    "jlaso/session-storage-bundle": "*"
    // ...
},

然后注册bundle到您的内核

// in AppKernel::registerBundles()
$bundles = array(
    // ...
    new JLaso\SessionStorageBundle\SessionStorageBundle(),
    // ...
);

配置

// in app/config/config.yml
services:
    pdo:
        class: PDO
        arguments:
            - "mysql:host=%database_host%;port=%database_port%;dbname=%database_name%"
            - "%database_user%"
            - "%database_password%"
        calls:
            - [setAttribute, [3, 2]] # \PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION
    session.handler.pdo:
        class:     Symfony\Component\HttpFoundation\Session\Storage\Handler\PdoSessionHandler
        arguments: ["@pdo", "%pdo.db_options%"]

使用

执行schema:update以在数据库中创建session

app/console doctrine:schema:update --force