instantech/session

This package is a simple encapsulation of PHP natif $_SESSION to Object Representation

Installs: 9

Dependents: 0

Suggesters: 0

Security: 0

Stars: 1

Watchers: 1

Forks: 0

pkg:composer/instantech/session

1 2019-11-11 09:38 UTC

This package is auto-updated.

Last update: 2025-10-11 23:54:09 UTC


README

This is a basic implementation of PHP super Global $_SESSION to Object representation. This package implement the flash message interface

Requirements

  • php >=7.1.0

Installation

  1. Installation
$ composer require instantech/session
  1. Usage
<?php
require_once __DIR__.'/vendor/autoload.php';
use Instantech\Session;

session_start();
//Set value in the session with key test
Session::set("test", 'value');
//Get value matched key test
Session::get('test');
//Set a flash message with key success and value IT's success
Session::addFlash('success', "IT's succes");
//Read the flash message with key success
echo Session::flash('success');
//Clear all information in the session
Session::clear();
//Get an array of all value in the session
Session::all();
//Check if some key test exist in the session
Session::has('test');
//Check if some key success exist in the flash message
Session::hasFlash('success');
//Remove the value from the session with key test
Session::remove('test');