Documentation

Abstract class Phalcon\Session\Adapter

extends abstract class Phalcon\Di\Injectable

implements Phalcon\Events\EventsAwareInterface, Phalcon\Di\InjectionAwareInterface, Phalcon\Session\AdapterInterface, Countable, IteratorAggregate, Traversable, ArrayAccess

Source on GitHub

Base class for Phalcon\Session adapters

Methods

public __construct ([array $options], [int $expire], [string $path], [boolean $secure], [string $domain], [boolean $httpOnly])

Phalcon\Session\Adapter constructor

public __destruct ()

...

public boolean start ()

Starts the session (if headers are already sent the session will not be started)

public setOptions (array $options)

Sets session’s options

<?php

$session->setOptions(array(
    'uniqueId' => 'my-private-app'
));

public array getOptions ()

Get internal options

public mixed get (string $index, [mixed $defaultValue])

Gets a session variable from an application context

public set (string $index, string $value)

Sets a session variable in an application context

<?php

$session->set('auth', 'yes');

public sets (array $data)

Sets a session variables in an application context

<?php

$session->sets(array('auth', 'yes'));

public boolean has (string $index)

Check whether a session variable is set in an application context

<?php

var_dump($session->has('auth'));

public remove (string $index)

Removes a session variable from an application context

<?php

$session->remove('auth');

public string getId ()

Returns active session id

<?php

echo $session->getId();

public boolean isStarted ()

Check whether the session has been started

<?php

var_dump($session->isStarted());

public boolean regenerate ([unknown $delete_old_session])

Update the current session id with a newly generated one

<?php

var_dump($session->regenerate());

public boolean destroy ([unknown $regenerate])

Destroys the active session

<?php

var_dump($session->destroy());

public __get (unknown $property)

...

public __set (unknown $property, unknown $value)

...

public __isset (unknown $property)

...

public __unset (unknown $property)

...

public offsetGet (unknown $property)

...

public offsetSet (unknown $property, unknown $value)

...

public offsetExists (unknown $property)

...

public offsetUnset (unknown $property)

...

public count ()

...

public getIterator ()

...

public setId (unknown $sid)

Set the current session id

<?php

$session->setId($id);

public setDI (Phalcon\DiInterface $dependencyInjector) inherited from Phalcon\Di\Injectable

Sets the dependency injector

public Phalcon\DiInterface getDI ([unknown $error], [unknown $notUseDefault]) inherited from Phalcon\Di\Injectable

Returns the internal dependency injector

public setEventsManager (Phalcon\Events\ManagerInterface $eventsManager) inherited from Phalcon\Di\Injectable

Sets the event manager

public Phalcon\Events\ManagerInterface getEventsManager () inherited from Phalcon\Di\Injectable

Returns the internal event manager

public boolean fireEvent (string $eventName, [mixed $data], [unknown $cancelable]) inherited from Phalcon\Di\Injectable

Fires an event, implicitly calls behaviors and listeners in the events manager are notified

public mixed fireEventCancel (string $eventName, [mixed $data], [unknown $cancelable]) inherited from Phalcon\Di\Injectable

Fires an event, can stop the event by returning to the false

public boolean hasService (string $name) inherited from Phalcon\Di\Injectable

Check whether the DI contains a service by a name

public Phalcon\Di\ServiceInterface setService (unknown $name) inherited from Phalcon\Di\Injectable

Sets a service from the DI

public object|null getService (unknown $name) inherited from Phalcon\Di\Injectable

Obtains a service from the DI

public mixed getResolveService (string $name, [array $args], [unknown $noerror], [unknown $noshared]) inherited from Phalcon\Di\Injectable

Resolves the service based on its configuration

public attachEvent (string $eventType, Closure $callback) inherited from Phalcon\Di\Injectable

Attach a listener to the events

public __sleep () inherited from Phalcon\Di\Injectable

...

public __debugInfo () inherited from Phalcon\Di\Injectable

...