Download the PHP package koded/session without Composer
On this page you can find all versions of the php package koded/session. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download koded/session
More information about koded/session
Files in koded/session
Package session
Short Description A session library with custom handlers and php.ini support
License BSD-3-Clause
Informations about the package session
Koded Session
The library relies on the php.ini
settings.
Every session ini directive can be reset with the
Koded\Session\SessionConfiguration
object.
Refer to php.ini session directives: http://php.net/manual/en/session.security.ini.php
Usage
The session is started automatically by using one of the 2 methods:
app configuration
or using a SessionMiddleware
include this middleware class in your middleware stack
Session class and function
The session class can be instantiated and used, but the function session()
is recommended instead an instance of Session
class.
Handlers Configuration
The bare minimum is to define the handler you want to use for the session:
If you do not choose one of the Redis or Memcached, it defaults to files
handler which is the PHP's default session mechanism.
However, the files
handler might not be desirable if your application
runs in Docker, Kubernetes, distributed environment, etc.
The best choice for PHP sessions is Redis in almost all situations.
WARNING: Memcached may drop the session data, because it's nature. Use it with caution!
Redis handler
A typical Redis settings:
- 1 server
- application + redis on the same machine
- Redis (127.0.0.1:6379)
- no auth (Redis is not available from outside)
To support huge volumes you need a good sysadmin skills and wast knowledge to set the Redis server(s).
Memcached handler
A typical Memcached settings:
- 1 server
- application + memcached on the same machine
- Memcached (127.0.0.1:11211)
To support huge amount of users you need a decent amounts of RAM on your servers. But Memcached is a master technology for this, so you should be fine.
Files handler
This one is not recommended for any serious business. It's fine only for small projects.
All session directives are copied from php.ini
.
A typical native PHP session settings:
You cannot use this handler if you've scaled your application, because the session data will most likely be handled randomly on a different instance for every HTTP request.
All versions of session with dependencies
psr/http-server-middleware Version ~1
koded/cache-simple Version ~2
koded/http Version ~1
ext-json Version *