Download the PHP package antonkalmykov/session-muscle without Composer
On this page you can find all versions of the php package antonkalmykov/session-muscle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download antonkalmykov/session-muscle
More information about antonkalmykov/session-muscle
Files in antonkalmykov/session-muscle
Package session-muscle
Short Description Session provider component for ITCourses Jazz Framework
License MIT
Homepage https://github.com/kalmykovanton/SessionMuscle.git
Informations about the package session-muscle
SessionMuscle
Session provider component for ITCourses Jazz Framework
How to use:
Every time when there is a request to the server, SessionMuscle will start session automatically. To modify or save current session data use SessionMuscle API methods. Under session type understood long-term session or short-term session. By default, all sessions are short-term. The duration of the sessions, you can specify in the session settings. Depending of the session type, session essentially will end on short or long postfix. For example:
63073ae80b786fdc21bb7616a54d25615e6c8f28short - name of short session
or 27s45ae80b987fsc22bs4576v54d25615w6c8f28long - name of long session
Garbage collector will start automatically, depending of 'runRate' session setting and session lifetime types.
NOTE: session repository must have read/write permissions.
First of all, create an array of settings for SessionMuscle component:
Then, create adapter which will be responsible for maintaining sessions (in this example, this is adapter who stored sessions into files):
And now you can create session instance, first argument is session adapter instance, second - session settings:
SessionMuscle API
Retrieve all data from the session:
Retrieve a value from the session. You may also pass a default value as the second argument to this method. This default value will be returned if the specified key does not exist in the session:
Add new data to current session:
Check if an item exists in the session:
Retrieve a value from the session, and then delete it. You may also pass a default value as the second argument to this method. This default value will be returned if the specified key does not exist in the session:
Remove a piece of data from the session by given key:
To get current session ID with session type (if exists), use:
To get current repository, use:
To get current session cookie name, use:
To get used session types, use:
To get current session type, use:
To set type of current session, use:
To get current session settings, use:
To save current session, use:
To regenerate current session, use:
To completely remove current session, use: