Phalcon session
NOTE
All classes are prefixed with Phalcon
Session\Adapter\AbstractAdapter ¶
-
Namespace
Phalcon\Session\Adapter
-
Uses
Phalcon\Storage\Adapter\AdapterInterface
SessionHandlerInterface
-
Extends
-
Implements
SessionHandlerInterface
This file is part of the Phalcon Framework.
(c) Phalcon Team team@phalcon.io
For the full copyright and license information, please view the LICENSE file that was distributed with this source code.
Properties¶
Methods¶
Close Destroy Garbage Collector Open Read Write @todo Remove this when we get traitsSession\Adapter\Libmemcached¶
-
Namespace
Phalcon\Session\Adapter
-
Uses
Phalcon\Storage\AdapterFactory
-
Extends
AbstractAdapter
-
Implements
Phalcon\Session\Adapter\Libmemcached
Methods¶
Libmemcached constructor.Session\Adapter\Noop¶
-
Namespace
Phalcon\Session\Adapter
-
Uses
SessionHandlerInterface
-
Extends
-
Implements
SessionHandlerInterface
Phalcon\Session\Adapter\Noop
This is an "empty" or null adapter. It can be used for testing or any other purpose that no session needs to be invoked
<?php
use Phalcon\Session\Manager;
use Phalcon\Session\Adapter\Noop;
$session = new Manager();
$session->setAdapter(new Noop());
Properties¶
/**
* The connection of some adapters
*
* @var null
*/
protected $connection;
/**
* Session options
*
* @var array
*/
protected $options;
/**
* Session prefix
*
* @var string
*/
protected $prefix = ;
/**
* Time To Live
*
* @var int
*/
protected $ttl = 8600;
Methods¶
Constructor Close Destroy Garbage Collector Open Read Write Helper method to get the name prefixedSession\Adapter\Redis¶
-
Namespace
Phalcon\Session\Adapter
-
Uses
Phalcon\Storage\AdapterFactory
-
Extends
AbstractAdapter
-
Implements
Phalcon\Session\Adapter\Redis
Methods¶
ConstructorSession\Adapter\Stream¶
-
Namespace
Phalcon\Session\Adapter
-
Uses
Phalcon\Session\Exception
-
Extends
Noop
-
Implements
Phalcon\Session\Adapter\Stream
This is the file based adapter. It stores sessions in a file based system
<?php
use Phalcon\Session\Manager;
use Phalcon\Session\Adapter\Stream;
$session = new Manager();
$files = new Stream(
[
'savePath' => '/tmp',
]
);
$session->setAdapter($files);
@property array $options @property string $prefix @property string $path
Properties¶
Methods¶
Constructor Garbage Collector Ignore the savePath and use local defined path Reads data from the adapterprotected function getArrVal( array $collection, mixed $index, mixed $defaultValue = null, string $cast = null ): mixed;
protected function phpFilePutContents( string $filename, mixed $data, int $flags = int, mixed $context = null );
Session\Bag¶
-
Namespace
Phalcon\Session
-
Uses
Phalcon\Di\Di
Phalcon\Di\DiInterface
Phalcon\Di\InjectionAwareInterface
Phalcon\Session\ManagerInterface
Phalcon\Support\Collection
-
Extends
Collection
-
Implements
BagInterface
InjectionAwareInterface
Phalcon\Session\Bag
This component helps to separate session data into "namespaces". Working by this way you can easily create groups of session variables into the application
@property DiInterface|null $container @property string $name @property ManagerInterface $session;
Properties¶
/**
* @var DiInterface|null
*/
private $container;
/**
* Session Bag name
*
* @var string
*/
private $name;
/**
* @var ManagerInterface
*/
private $session;
Methods¶
Destroys the session bag Returns the DependencyInjector container Initialize internal array Removes a property from the internal bag Sets a value in the session bag Sets the DependencyInjector containerSession\BagInterface ¶
-
Namespace
Phalcon\Session
-
Uses
-
Extends
-
Implements
Phalcon\Session\BagInterface
Interface for Phalcon\Session\Bag
Methods¶
Session\Exception¶
-
Namespace
Phalcon\Session
-
Uses
-
Extends
\Exception
-
Implements
Phalcon\Session\Exception
Exceptions thrown in Phalcon\Session will use this class
Session\Manager¶
-
Namespace
Phalcon\Session
-
Uses
InvalidArgumentException
Phalcon\Di\AbstractInjectionAware
Phalcon\Di\DiInterface
Phalcon\Support\Helper\Arr\Get
RuntimeException
SessionHandlerInterface
-
Extends
AbstractInjectionAware
-
Implements
ManagerInterface
@property SessionHandlerInterface|null $adapter @property string $name @property array $options @property string $uniqueId
Properties¶
/**
* @var SessionHandlerInterface|null
*/
private $adapter;
/**
* @var string
*/
private $name = ;
/**
* @var array
*/
private $options;
/**
* @var string
*/
private $uniqueId = ;
Methods¶
Manager constructor. Alias: Gets a session variable from an application context Alias: Check whether a session variable is set in an application context Alias: Sets a session variable in an application context Alias: Removes a session variable from an application context Destroy/end a session Check whether the session has been started Gets a session variable from an application context Returns the stored session adapter Returns the session id Returns the name of the session Get internal options Check whether a session variable is set in an application context Regenerates the session id using the adapter. Removes a session variable from an application context Sets a session variable in an application context Set the adapter for the session Set session Id Set the session name. Throw exception if the session has started and do not allow poop names Sets session's options Starts the session (if headers are already sent the session will not be started) Returns the status of the current session. Checks if or where headers have been sentSession\ManagerInterface ¶
-
Namespace
Phalcon\Session
-
Uses
InvalidArgumentException
RuntimeException
SessionHandlerInterface
-
Extends
-
Implements
Phalcon\Session
Interface for the Phalcon\Session\Manager
Constants¶
Methods¶
Alias: Gets a session variable from an application context Alias: Check whether a session variable is set in an application context Alias: Sets a session variable in an application context Alias: Removes a session variable from an application context Destroy/end a session Check whether the session has been started Gets a session variable from an application context Returns the stored session adapter Returns the session id Returns the name of the session Get internal options Check whether a session variable is set in an application context Regenerates the session id using the adapter. Removes a session variable from an application context Sets a session variable in an application context Set the adapter for the session Set session Id Set the session name. Throw exception if the session has started and do not allow poop names@throws InvalidArgumentException
Sets session's options Starts the session (if headers are already sent the session will not be started) Returns the status of the current session.