Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

Transfer of 'external' $_SESSION to phalcon

Hi, If we try to integrate phalcon with a standalone library\script which uses its own native $SESSION what is the best way to transfer the $SESSION to the Phalcon environment.

We can get this working like below but we think this is probably not a good method to do a session_start()

$session_start();
$di->setShared('session', function() {
    $session = new Phalcon\Session\Adapter\Files();
    $session->start();
    $session->set('test', $_SESSION);
    return $session;
});


84.5k
Accepted
answer

You don't need to do this, accessing $session->get('test') is like doing $_SESSION['test']



1.7k

So simple I didn't see it. Thank you.