src/Backpack/Bootstrap/Session.php
public function boot()
    {
        if ((php_sapi_name() === 'cli' || defined('STDIN'))) {
            return;
        }

        if (session_status() == PHP_SESSION_ACTIVE) {
            throw new Exception('Session is already started');
        }

        // save path
        if ($this->app->hasProp($this->sessionPropName.'.save_path')) {
            session_save_path($this->app->getProp($this->sessionPropName.'.save_path'));
        }

        // save handler class
        if ($this->app->hasProp($this->sessionPropName.'.save_handler')) {
            session_set_save_handler($this->app->getProp($this->sessionPropName.'.save_handler'));
        }

        // name the session
        if ($this->app->hasProp($this->sessionPropName.'.name')) {
            session_name($this->app->getProp($this->sessionPropName.'.name'));
        }

        // session options
        $options = [];
        if ($this->app->hasProp($this->sessionPropName.'.options')) {
            $options = $this->app->getProp($this->sessionPropName.'.options');
        }

        // start the session
        session_start($options);
    }
public function boot()
    {
        if ((php_sapi_name() === 'cli' || defined('STDIN'))) {
            return;
        }

        if (session_status() == PHP_SESSION_ACTIVE) {
            throw new Exception('Session is already started');
        }

        // save path
        if ($this->app->hasProp($this->sessionPropName.'.save_path')) {
            session_save_path($this->app->getProp($this->sessionPropName.'.save_path'));
        }

        // save handler class
        if ($this->app->hasProp($this->sessionPropName.'.save_handler')) {
            session_set_save_handler($this->app->getProp($this->sessionPropName.'.save_handler'));
        }

        // name the session
        if ($this->app->hasProp($this->sessionPropName.'.name')) {
            session_name($this->app->getProp($this->sessionPropName.'.name'));
        }

        // session options
        $options = [];
        if ($this->app->hasProp($this->sessionPropName.'.options')) {
            $options = $this->app->getProp($this->sessionPropName.'.options');
        }

        // start the session
        session_start($options);
    }
public function boot ( ) { if ( ( php_sapi_name ( ) === 'cli' || defined ( 'STDIN' ) ) ) { return ; } if ( session_status ( ) == PHP_SESSION_ACTIVE ) { throw new Exception ( 'Session is already started' ) ; } // save path if ( $ this -> app -> hasProp ( $ this -> sessionPropName . '.save_path' ) ) { session_save_path ( $ this -> app -> getProp ( $ this -> sessionPropName . '.save_path' ) ) ; } // save handler class if ( $ this -> app -> hasProp ( $ this -> sessionPropName . '.save_handler' ) ) { session_set_save_handler ( $ this -> app -> getProp ( $ this -> sessionPropName . '.save_handler' ) ) ; } // name the session if ( $ this -> app -> hasProp ( $ this -> sessionPropName . '.name' ) ) { session_name ( $ this -> app -> getProp ( $ this -> sessionPropName . '.name' ) ) ; } // session options $ options = [ ] ; if ( $ this -> app -> hasProp ( $ this -> sessionPropName . '.options' ) ) { $ options = $ this -> app -> getProp ( $ this -> sessionPropName . '.options' ) ; } // start the session session_start ( $ options ) ; }
Setup and start session from app props
@throws Exception
Setup and start session from app props