src/SessionManager.php
public static function sessionStart($name, $lifetime = 0, $path = '/', $domain = null, $secure = null)
    {
        // Set the cookie name before we start.
        session_name($name . '_Session');

        // Set the domain to default to the current domain.
        $domain = isset($domain) ? $domain : $_SERVER['SERVER_NAME'];

        // Set the default secure value to whether the site is being accessed with SSL
        $secure = isset($secure) ? $secure : isset($_SERVER['HTTPS']);

        // Set the cookie settings and start the session
        session_set_cookie_params($lifetime, $path, $domain, $secure, true);

        $id = session_id();
        if(empty($id)) {
            session_start();
        }

        // Make sure the session hasn't expired, and destroy it if it has
        if (self::validateSession()) {

            // Check to see if the session is new or a hijacking attempt
            if (!self::preventHijacking()) {

                // Reset session data and regenerate id
                $_SESSION = array();
                $_SESSION['ipAddress'] = $_SERVER['REMOTE_ADDR'];
                $_SESSION['userAgent'] = $_SERVER['HTTP_USER_AGENT'];
                self::regenerateSession();

                // Give a 5% chance of the session id changing on any request
            } elseif (self::shouldRandomlyRegenerate()) {
                self::regenerateSession();
            }
        } else {
            self::destroySession();
        }
    }
public static function sessionStart($name, $lifetime = 0, $path = '/', $domain = null, $secure = null)
    {
        // Set the cookie name before we start.
        session_name($name . '_Session');

        // Set the domain to default to the current domain.
        $domain = isset($domain) ? $domain : $_SERVER['SERVER_NAME'];

        // Set the default secure value to whether the site is being accessed with SSL
        $secure = isset($secure) ? $secure : isset($_SERVER['HTTPS']);

        // Set the cookie settings and start the session
        session_set_cookie_params($lifetime, $path, $domain, $secure, true);

        $id = session_id();
        if(empty($id)) {
            session_start();
        }

        // Make sure the session hasn't expired, and destroy it if it has
        if (self::validateSession()) {

            // Check to see if the session is new or a hijacking attempt
            if (!self::preventHijacking()) {

                // Reset session data and regenerate id
                $_SESSION = array();
                $_SESSION['ipAddress'] = $_SERVER['REMOTE_ADDR'];
                $_SESSION['userAgent'] = $_SERVER['HTTP_USER_AGENT'];
                self::regenerateSession();

                // Give a 5% chance of the session id changing on any request
            } elseif (self::shouldRandomlyRegenerate()) {
                self::regenerateSession();
            }
        } else {
            self::destroySession();
        }
    }
Creates a secure session
@param $name
@param int $lifetime
@param string $path
@param null $domain
@param null $secure