PHP Classes

Writable PHP Session Path: Start sessions assuring the save directory exists

Recommend this page to a friend!
  Info   Documentation   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 86 All time: 10,018 This week: 660Up
Version License PHP version Categories
session-path 1.0.0GNU General Publi...5PHP 5, User Management
Description 

Author

This package can start sessions assuring the save directory exists.

It can start a PHP session for the current script and make PHP store the session data in a given directory.

If the session storage directory does not exist, the class creates the directory and gives it the right permissions.

Innovation Award
PHP Programming Innovation award nominee
December 2021
Number 7
Sessions are a helpful feature of the PHP language that developers use to store the application values relevant to the current user.

PHP Sessions only work if the PHP configuration specifies a directory and has the correct read and write permissions to allow the current Web server user to access it.

This package can start PHP sessions and assure the session data storage directory exists and has the correct configuration.

Manuel Lemos
Picture of Ali YILMAZ
  Performance   Level  
Name: Ali YILMAZ <contact>
Classes: 16 packages by
Country: Turkey Turkey
Age: ???
All time rank: 249042 in Turkey Turkey
Week rank: 215 Up5 in Turkey Turkey Up
Innovation award
Innovation award
Nominee: 8x

Documentation

What is session ?

This package is used to start session and set session path.

Getting settings from constructor method

By default, server settings are referenced. If the settings are sent to the project's __construct method, these settings take effect.

Out-of-class use:

code:

require_once('Mind.php');
$m = new Mind([ 
    'session'=>array(
        'path'=>'./session/',
        'status'=>true
    )
]);
$m::aliyilmaz('session')->start();

When using it in the class:

code:

self::$conf = [ 
    'session'=>array(
        'path'=>'./session/',
        'status'=>true
    )
];

self::aliyilmaz('session')->start();

Define the session path

It must be run before the session initialization method, it can be used as a chain.

Out-of-class use:

code:

require_once('Mind.php');
$m = new Mind();
$m::aliyilmaz('session')->setPath('./session/')->start();

When using it in the class:

code:

self::aliyilmaz('session')->setPath('./session/')->start();

Creating / using session parameters

Out-of-class use:

code:

require_once('Mind.php');
$m = new Mind();
$m::aliyilmaz('session')->start();
$_SESSION['user'] = [
    'username'=>'aliyilmaz',
    'id'=>1
];
print_r($_SESSION);

When using it in the class:

code:

self::aliyilmaz('session')->start();
$_SESSION['user'] = [
    'username'=>'aliyilmaz',
    'id'=>1
];
print_r($_SESSION);

output:

Array ( [user] => Array ( [username] => aliyilmaz [id] => 1 ) )

Dependencies

This package has no dependencies.

License

Instructions and files in this directory are shared under the GPL3 license.


  Files folder image Files (3)  
File Role Description
Files folder imagesrc (1 file)
Accessible without login Plain text file LICENSE Lic. License text
Accessible without login Plain text file README.md Doc. Documentation

  Files folder image Files (3)  /  src  
File Role Description
  Plain text file session.php Class Class source

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 100%
Total:86
This week:0
All time:10,018
This week:660Up