All Projects → Ghostff → Session

Ghostff / Session

Licence: other
PHP Session Manager (non-blocking, flash, segment, session encryption)

Programming Languages

PHP
23972 projects - #3 most used programming language

Projects that are alternatives of or similar to Session

Aura.session
Tools for managing sessions, including session segments and read-once messages
Stars: ✭ 185 (+704.35%)
Mutual labels:  flash, session
sessionx
Go's web session library.
Stars: ✭ 75 (+226.09%)
Mutual labels:  session, session-management
laravel-remember-all
A Laravel session driver to remember all devices a user has logged in with.
Stars: ✭ 30 (+30.43%)
Mutual labels:  session, session-management
session
Aplus Framework Session Library
Stars: ✭ 170 (+639.13%)
Mutual labels:  memcached, session
Modern-UI-Components-for-VBA
A helper dll for VBA users to design modern UI components. No install required!
Stars: ✭ 139 (+504.35%)
Mutual labels:  non-blocking
python-pytest-harvest
Store data created during your `pytest` tests execution, and retrieve it at the end of the session, e.g. for applicative benchmarking purposes.
Stars: ✭ 44 (+91.3%)
Mutual labels:  session
pixas-editor
Isometric pixel graphics editor
Stars: ✭ 24 (+4.35%)
Mutual labels:  flash
stm32bl
STM32 MCU serial firmware loader (jet another stm32loader fw bootloader tool)
Stars: ✭ 22 (-4.35%)
Mutual labels:  flash
transform-swf
A Java library for reading and writing Flash files. Fully supports Flash 10.
Stars: ✭ 55 (+139.13%)
Mutual labels:  flash
iron-session
🛠 Node.js stateless session utility using signed and encrypted cookies to store data. Works with Next.js, Express, NestJs, Fastify, and any Node.js HTTP framework.
Stars: ✭ 1,729 (+7417.39%)
Mutual labels:  session
app
Aplus Framework App Project
Stars: ✭ 338 (+1369.57%)
Mutual labels:  session
limits
Rate limiting using various strategies and storage backends such as redis & memcached
Stars: ✭ 178 (+673.91%)
Mutual labels:  memcached
netman
高性能的TCP网络框架、支持TLS、可配置的路由、websocket、基于事件循环(epoll),百万连接(C1000K)
Stars: ✭ 96 (+317.39%)
Mutual labels:  non-blocking
mx.sh
Lean and opinionated tmux session manager.
Stars: ✭ 20 (-13.04%)
Mutual labels:  session-management
memcacher
C++ implementation of Memcache Binary Protocol.
Stars: ✭ 16 (-30.43%)
Mutual labels:  memcached
SpringSecurityInEasySteps
Learn Spring Security step by step
Stars: ✭ 13 (-43.48%)
Mutual labels:  session-management
FLARToolKit
No description or website provided.
Stars: ✭ 14 (-39.13%)
Mutual labels:  flash
egg-session-redis
redis store for egg session
Stars: ✭ 41 (+78.26%)
Mutual labels:  session
homebrew-extensions
🍻 Homebrew tap for PHP extensions
Stars: ✭ 264 (+1047.83%)
Mutual labels:  memcached
go-elasticache
Thin abstraction over the Memcache client package gomemcache (https://github.com/bradfitz/gomemcache) allowing it to support AWS ElastiCache cluster nodes
Stars: ✭ 15 (-34.78%)
Mutual labels:  memcached

Session PHP(7.4+)

PHP Session Manager (non-blocking, flash, segment, session encryption). Uses PHP open_ssl for optional encrypt/decryption of session data.

Driver support Scope

file    cookie    pdo    memcached    redis    license    Minimum PHP Version

Installation

You can download the Latest release version as a standalone, alternatively you can use Composer

composer require ghostff/session

Basic usage

# Start session with default default or specified configurations.
$session = new Session(); 

$session->set('email', '[email protected]');

echo $session->get('email');

Configuration Options

# use custom configuration file.
Session::setConfigurationFile('path/to/my/config.php');
 
# overriding specific configuration settings
Session::updateConfiguration([
    Session::CONFIG_DRIVER        => Redis::class,
    Session::CONFIG_START_OPTIONS => [
        Session::CONFIG_START_OPTIONS_SAVE_PATH => __DIR__ . '/tmp'
    ]
]);

# override a configuration for current session instance
$session = new Session([Session::CONFIG_ENCRYPT_DATA => true]);

Initializing Session

# Start session with an auto generated id.
$session = new Session(); 

# Start session with custom ID
$session = new Session(null, bin2hex(random_bytes(32)));

Using Segment :Session

 $segment = $session->segment('my_segment');

Retrieving Session ID :string

echo $session->id();

Committing changes :void

# Opens, writes and closes session.
$session->commit();

Setting Session Data :Session

$session->set('fname', 'foo');
# Setting Segment
$segment->set('name', 'bar');

# Setting Flash
$session->setFlash('name', 'foobar');
# Setting Segment Flash
$segment->setFlash('name', 'barfoo');

$session->commit();

Retrieving Session Data :mixed

echo $session->get('name'); # outputs foo
echo $session->getOrDefault('unset_value', 'not found'); # outputs not found
# Retrieving Segment
echo $segment->get('name'); # outputs bar
echo $segment->getOrDefault('unset_value', 'not found'); # outputs not found

# Retrieving Flash
echo $session->getFlash('name'); # outputs foobar
echo $session->getFlashOrDefault('name', 'not found'); # outputs not found
# Retrieving Segment Flash
echo $segment->getFlash('name'); # outputs barfoo
echo $segment->getFlashOrDefault('name', 'not found'); # outputs not found

Removing Session Data :Session

$session->del('name');
# Removing Segment
$segment->del('name');

# Removing Flash
$session->delFlash('name');
# Removing Segment Flash
$segment->delFlash('name');

Retrieve all session or segment data :array

$session->getAll();
# Retrieve only in specified segment.
$session->getAll('my_segment_name');

Check if variable exist in current session namespace :bool

$session->exist('name');
# Search flashes
$session->exist('name', true);

Removing all data in current segment :Session

$session->clear();

Destroying session :void

$session->destroy();

Regenerate session ID :void

$session->rotate();
# Delete the old associated session file or not
$session->rotate(true);

Setting Queued Session Data :Session

$session->push('age', 10)
        ->push('age', 20)
        ->push('age', 30)
        ->push('age', 40);

Retrieving (pop/shift) Queued Session Data :mixed

echo $session->pop('age', true);  # outputs 10
echo $session->pop('age', true);  # outputs 20
echo $session->pop('age');        # outputs 40
echo $session->pop('age');        # outputs 30
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].