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    
Last Updated Ratings Unique User Downloads Download Rankings
2021-12-28 (17 days ago) RSS 2.0 feedNot yet rated by the usersTotal: 39 This week: 2All time: 10,290 This week: 89Up
Version License PHP version Categories
session-path 1.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
Nominee
Vote
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
Name: Ali YILMAZ <contact>
Classes: 8 packages by
Country: Turkey Turkey
Innovation award
Innovation award
Nominee: 4x

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:39
This week:2
All time:10,290
This week:89Up
For more information send a message to info at phpclasses dot org.