PHP Classes

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

Recommend this page to a friend!
  Info   View files Documentation   View files View files (3)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog (1)    
Last Updated Ratings Unique User Downloads Download Rankings
2021-12-28 (9 months ago) RSS 2.0 feedNot yet rated by the usersTotal: 81 This week: 1All time: 9,895 This week: 177Up
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: 15 packages by
Country: Turkey Turkey
Age: ???
All time rank: 260343 in Turkey Turkey
Week rank: 83 Up3 in Turkey Turkey Up
Innovation award
Innovation award
Nominee: 7x

Details

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  
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  /  src  
File Role Description
  Plain text file session.php Class Class source

 Version Control Unique User Downloads Download Rankings  
 100%
Total:81
This week:1
All time:9,895
This week:177Up
For more information send a message to info at phpclasses dot org.