drago-ex/sessions

Helper class for accessing Nette session and session sections outside presenters.

v1.0.6 2025-01-24 12:49 UTC

This package is auto-updated.

Last update: 2025-01-24 13:31:17 UTC


README

A helper package for managing sessions outside the presenter in Nette Framework.

License: MIT PHP version Tests Coding Style CodeFactor Coverage Status

Technology

  • PHP 8.3 or higher
  • composer

Features

  • Provides access to Nette sessions and session sections outside the presenter.
  • Ideal for managing session data in services or components within a Nette application.

Knowledge

  • Sessions

Installation

composer require drago-ex/sessions

Service registration

In your neon configuration, register the ExtraSession service:

service:
	- Drago\Http\ExtraSession(@Nette\Http\Session, 'namespace')

Usage

Setting session values

// Setting a session value in the specified section.
$this->ExtraSession->getSessionSection()->set('key', 'value');

Reading session values

// Getting a session value from the section.
$value = $this->ExtraSession->getSessionSection()->get('key');