Download the PHP package fyre/session without Composer
On this page you can find all versions of the php package fyre/session. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package session
FyreSession
FyreSession is a free, open-source session library for PHP.
Table Of Contents
- Installation
- Basic Usage
- Methods
- Session Handlers
- Database
- MySQL
- Postgres
- File
- Memcached
- Redis
- Database
Installation
Using Composer
In PHP:
Basic Usage
Default configuration options will be resolved from the "Session" key in the Config.
$options
is an array containing configuration options.cookie
is an array containing session cookie options.name
is a string representing the cookie name, and will default to "FyreSession".expires
is a number representing the cookie lifetime, and will default to 0.domain
is a string representing the cookie domain, and will default to "".path
is a string representing the cookie path, and will default to "/".secure
is a boolean indicating whether to set a secure cookie, and will default to true.sameSite
is a string representing the cookie same site, and will default to "Lax".
expires
is a number representing the maximum lifetime of a session, and will default to thesession.gc_maxlifetime
PHP setting.path
is a string representing the session path, and will default to "sessions".handler
className
must be set to\Fyre\Session\Handlers\Database\PostgresSessionHandler
.
Autoloading
It is recommended to bind the Session to the Container as a singleton.
Any dependencies will be injected automatically when loading from the Container.
Methods
Clear
Clear the session data.
Consume
Retrieve and delete a value from the session.
$key
is a string representing the session key.
Delete
Delete a value from the session.
$key
is a string representing the session key.
Destroy
Destroy the session.
Get
Retrieve a value from the session.
$key
is a string representing the session key.
Has
Determine whether a value exists in the session.
$key
is a string representing the session key.
ID
Get the session ID.
Is Active
Determine whether the session is active.
Refresh
Refresh the session ID.
$deleteOldSession
is a boolean indicating whether to delete the old session, and will default to false.
Set
Set a session value.
$key
is a string representing the session key.$value
is the value to set.
Set Flash
Set a session flash value.
$key
is a string representing the session key.$value
is the value to set.
Set Temp
Set a session temporary value.
$key
is a string representing the session key.$value
is the value to set.$expire
is a number indicating the number of seconds the value will be valid, and will default to 300.
Start
Start the session.
$options
is an array containing configuration options.
Session Handlers
You can load a specific session handler by specifying the Session.handler.className
Config option.
Custom session handlers can be created by extending \Fyre\Session\SessionHandler
and implementing the SessionHandlerInterface
.
Database
The Database session handler can be loaded using custom configuration.
$options
is an array containing configuration options.className
must be set to\Fyre\Session\Handlers\DatabaseSessionHandler
.expires
is a number representing the maximum lifetime of a session, and will default to thesession.gc_maxlifetime
PHP setting.prefix
is a string representing the session key prefix, and will default to "".connectionKey
is a string representing the Connection key and will default to "default".path
is a string representing the table name, and will default to "sessions".
MySQL
The MySQL database session handler can be loaded using custom configuration.
$options
is an array containing configuration options.className
must be set to\Fyre\Session\Handlers\Database\MysqlSessionHandler
.expires
is a number representing the maximum lifetime of a session, and will default to thesession.gc_maxlifetime
PHP setting.prefix
is a string representing the session key prefix, and will default to "".connectionKey
is a string representing the Connection key and will default to "default".path
is a string representing the table name, and will default to "sessions".
Postgres
The Postgres database session handler can be loaded using custom configuration.
$options
is an array containing configuration options.className
must be set to\Fyre\Session\Handlers\Database\PostgresSessionHandler
.expires
is a number representing the maximum lifetime of a session, and will default to thesession.gc_maxlifetime
PHP setting.prefix
is a string representing the session key prefix, and will default to "".connectionKey
is a string representing the Connection key and will default to "default".path
is a string representing the table name, and will default to "sessions".
File
The File session handler can be loaded using custom configuration.
$options
is an array containing configuration options.className
must be set to\Fyre\Session\Handlers\FileSessionHandler
.expires
is a number representing the maximum lifetime of a session, and will default to thesession.gc_maxlifetime
PHP setting.prefix
is a string representing the session key prefix, and will default to "".path
is a string representing the directory path, and will default to "sessions".
Memcached
The Memcached session handler can be loaded using custom configuration.
$options
is an array containing configuration options.className
must be set to\Fyre\Session\Handlers\MemcachedSessionHandler
.expires
is a number representing the maximum lifetime of a session, and will default to thesession.gc_maxlifetime
PHP setting.prefix
is a string representing the session key prefix, and will default to "session:".host
is a string representing the Memcached host, and will default to "127.0.0.1".port
is a number indicating the Memcached port, and will default to 11211.weight
is a string representing the server weight, and will default to 1.
Redis
The Redis session handler can be loaded using custom configuration.
$options
is an array containing configuration options.className
must be set to\Fyre\Session\Handlers\RedisSessionHandler
.expires
is a number representing the maximum lifetime of a session, and will default to thesession.gc_maxlifetime
PHP setting.prefix
is a string representing the session key prefix, and will default to "session:".host
is a string representing the Redis host, and will default to "127.0.0.1".password
is a string representing the Redis passwordport
is a number indicating the Redis port, and will default to 6379.database
is a string representing the Redis database.timeout
is a number indicating the connection timeout.persist
is a boolean indicating whether to use a persistent connection, and will default to true.tls
is a boolean indicating whether to use a tls connection, and will default to true.ssl
is an array containing SSL options.key
is a string representing the path to the key file.cert
is a string representing the path to the certificate file.ca
is a string representing the path to the certificate authority file.
All versions of session with dependencies
fyre/container Version ^1.0
fyre/db Version ^6.0
fyre/filesystem Version ^2.0
fyre/path Version ^2.0
fyre/schema Version ^6.0