Download the PHP package horizom/session without Composer
On this page you can find all versions of the php package horizom/session. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package session
Horizom Session
PHP library for handling sessions.
- Requirements
- Installation
- Available Methods
- Quick Start
- Usage
- Tests
- TODO
- Changelog
- Contribution
- Sponsor
- License
Requirements
This library is compatible with the PHP versions: 8.0 | 8.1.
Installation
The preferred way to install this extension is through Composer.
To install PHP Session library, simply:
The previous command will only install the necessary files, if you prefer to download the entire source code you can use:
Available Methods
Available methods in this library:
Starts the session
@see https://php.net/session.configuration
for List of available $options
and their default values
@throws SessionException
If headers already sent
@throws SessionException
If session already started
@throws SessionException
If setting options failed
@Return bool
Check if the session is started
@Return bool
Sets an attribute by name
@throws SessionException
If session is unstarted
@Return void
Gets an attribute by name
Optionally defines a default value when the attribute does not exist.
@Return mixed
Value
Gets all attributes
@Return array
$_SESSION content
Check if an attribute exists in the session
@Return bool
Sets several attributes at once
If attributes exist they are replaced, if they do not exist they are created.
@throws SessionException
If session is unstarted
@Return void
Deletes an attribute by name and returns its value
Optionally defines a default value when the attribute does not exist.
@throws SessionException
If session is unstarted
@Return mixed
Attribute value
Deletes an attribute by name
@throws SessionException
If session is unstarted
@Return void
Free all session variables
@throws SessionException
If session is unstarted
@Return void
Gets the session ID
@Return string
Session ID
Sets the session ID
@throws SessionException
If session already started
@Return void
Update the current session id with a newly generated one
@throws SessionException
If session is unstarted
@Return bool
Gets the session name
@Return string
Session name
Sets the session name
@throws SessionException
If session already started
@Return void
Destroys the session
@throws SessionException
If session is unstarted
@Return bool
Quick Start
To use this library with Composer:
Or instead you can use a facade to access the methods statically:
Usage
Example of use for this library:
- Starts the session
Without setting options:
Setting options:
Using the facade:
- Check if the session is started
Using session object:
Using the facade:
- Sets an attribute by name
Using session object:
Using the facade:
- Gets an attribute by name
Without default value if attribute does not exist:
With default value if attribute does not exist:
Using the facade:
- Gets all attributes
Using session object:
Using the facade:
- Check if an attribute exists in the session
Using session object:
Using the facade:
- Sets several attributes at once
Using session object:
Using the facade:
- Deletes an attribute by name and returns its value
Without default value if attribute does not exist:
With default value if attribute does not exist:
Using the facade:
- Deletes an attribute by name
Using session object:
Using the facade:
- Free all session variables
Using session object:
Using the facade:
- Gets the session ID
Using session object:
Using the facade:
- Sets the session ID
Using session object:
Using the facade:
- Update the current session id with a newly generated one
Regenerate ID without deleting the old session:
Regenerate ID by deleting the old session:
Using the facade:
- Gets the session name
Using session object:
Using the facade:
- Sets the session name
Using session object:
Using the facade:
- Destroys the session
Using session object:
Using the facade:
License
This repository is licensed under the MIT License.