PHPackages                             effectra/session - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. effectra/session

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

effectra/session
================

The Effectra Session package.

v1.0.0(3y ago)1272MITPHPPHP ^8.0.2

Since May 25Pushed 3y agoCompare

[ Source](https://github.com/effectra/session)[ Packagist](https://packagist.org/packages/effectra/session)[ Docs](https://www.effectra.com)[ RSS](/packages/effectra-session/feed)WikiDiscussions main Synced today

READMEChangelog (1)DependenciesVersions (2)Used By (2)

Effectra Session
================

[](#effectra-session)

The `Session` class represents a session and provides methods for session management.

Table of Contents
-----------------

[](#table-of-contents)

- [Installation](#installation)
- [Usage](#usage)
- [Methods](#methods)
- [Example](#example)

Installation
------------

[](#installation)

You can install the `Session` class via Composer by running the following command:

```
composer require effectra/session

```

Usage
-----

[](#usage)

To use the `Session` class, you need to include it in your PHP file:

```
require_once 'vendor/autoload.php';

use Effectra\Session\Session;

// Create a new instance of the Session class
$session = new Session();

// Start the session
$session->start();

// Use session methods to manage session data
// ...

// Save and close the session
$session->save();
```

Methods
-------

[](#methods)

The `Session` class provides the following methods:

- `start()`: Starts the session.
- `save()`: Saves and closes the session.
- `isActive()`: Checks if the session is active.
- `get(string $key, mixed $default = null)`: Retrieves the value for the given key from the session.
- `has(string $key): bool`: Checks if the given key exists in the session.
- `regenerate(): bool`: Regenerates the session ID.
- `put(string $key, mixed $value)`: Sets a value in the session for the given key.
- `forget(string $key)`: Removes the value for the given key from the session.
- `flash(string $key, array $messages)`: Sets a flash message in the session for the given key.
- `getFlash(string $key): array`: Retrieves the flash message for the given key from the session.

Example
-------

[](#example)

Here's an example of how to use the `Session` class:

```
// Create a new instance of the Session class
$session = new Session();

// Start the session
$session->start();

// Set a value in the session
$session->put('username', 'john_doe');

// Get a value from the session
$username = $session->get('username');

// Check if a key exists in the session
if ($session->has('username')) {
    // Do something
}

// Regenerate the session ID
$session->regenerate();

// Set a flash message in the session
$session->flash('success', ['Logged in successfully!']);

// Retrieve and display the flash message
$successMessage = $session->getFlash('success');
echo $successMessage[0];

// Save and close the session
$session->save();
```

###  Health Score

24

—

LowBetter than 31% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

1135d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/7e6219ae87e98df8783b2f595b013035dd183c0712afd24045a8acf0a40c3bdf?d=identicon)[effectra](/maintainers/effectra)

---

Top Contributors

[![BMTmohammedtaha](https://avatars.githubusercontent.com/u/95439605?v=4)](https://github.com/BMTmohammedtaha "BMTmohammedtaha (7 commits)")

---

Tags

phpsession

### Embed Badge

![Health badge](/badges/effectra-session/health.svg)

```
[![Health](https://phpackages.com/badges/effectra-session/health.svg)](https://phpackages.com/packages/effectra-session)
```

###  Alternatives

[inspiredminds/contao-file-usage

Contao extension that allows you to search for references of files in the database assisted file manager.

1214.5k13](/packages/inspiredminds-contao-file-usage)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
