drupol/drupal7_session_services

This package is abandoned and no longer maintained. No replacement package was suggested.

Provides Session services to connect to Drupal 7 session management.

0.1.0 2018-02-27 20:09 UTC

This package is auto-updated.

Last update: 2023-02-17 06:42:01 UTC


README

Build Status

Drupal 7 Session Services

This library provides a session storage handler for using the Drupal 7 session mechanism with HTTPFoundation Symfony's session component.

If you need to use Drupal 7 and a library that rely on Symfony's HTTPFoundation component for handling sessions, you will need this to share session information between the library and Drupal.

Installation

composer require drupol/drupal7_session_services

Usage

  session:
    class: Symfony\Component\HttpFoundation\Session\Session
    arguments: ['@session_storage', '@attribute_bags', '@flash_bag']

  session_storage:
    class: Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage
    arguments: [[], '@session_handler', null]

  session_handler:
    class: drupol\drupal7_session_services\Session\Storage\Handler\Drupal7SessionHandler

  attribute_bags:
    class: Symfony\Component\HttpFoundation\Session\Attribute\NamespacedAttributeBag

  flash_bag:
    class: Symfony\Component\HttpFoundation\Session\Flash\FlashBag

or with PHP:

  $drupal7SessionHandler = new \drupol\drupal7_session_services\Session\Storage\Handler\Drupal7SessionHandler();
  $sessionstorage = new \Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage([], $drupal7SessionHandler, null);
  $attributeBag = new \Symfony\Component\HttpFoundation\Session\Attribute\NamespacedAttributeBag();
  $flashBag = new \Symfony\Component\HttpFoundation\Session\Flash\FlashBag();

  $session = new \Symfony\Component\HttpFoundation\Session\Session($sessionstorage, $attributeBag, $flashBag);

Run the tests

composer install
./vendor/bin/grumphp run