PHPackages                             prog98rammer/php-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. prog98rammer/php-session

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

prog98rammer/php-session
========================

A PHP Session Class

1.0(8y ago)8382MITPHP

Since Apr 3Pushed 8y ago1 watchersCompare

[ Source](https://github.com/khalidsheet/session-manager)[ Packagist](https://packagist.org/packages/prog98rammer/php-session)[ RSS](/packages/prog98rammer-php-session/feed)WikiDiscussions master Synced 4d ago

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

PHP Session Manager
===================

[](#php-session-manager)

### Allows you to deal with Session in php

[](#allows-you-to-deal-with-session-in-php)

---

Installation
============

[](#installation)

```
#include your file
include './to/path/session-manager.php';

use Prog98rammer\Session\Session;

// start the session.
$session = new Session();
```

Usage
=====

[](#usage)

\-- **Basic Usage**

Set the sessoin prefix
----------------------

[](#set-the-sessoin-prefix)

#### There are two ways to set the prefix

[](#there-are-two-ways-to-set-the-prefix)

\-- **First One**

```
$session = new Session($prefix);
```

\-- Example

```
$session = new Session('test_');
```

#### Second way

[](#second-way)

```
$session = new Session;
$session->prefix('test_')->set('name', 'khalid'); // it will set the session as "test_name"
```

#### Get the session prefix

[](#get-the-session-prefix)

```
$sesssion->getPrefix(); // will return the session prefix
```

#### Get all session keys

[](#get-all-session-keys)

```
$sesssion->all();
```

#### Add new session

[](#add-new-session)

```
// store the new session
$session->set($key, $value);

// for Example
$session->set('name', 'John');
```

#### Add more than one session by Chaining method

[](#add-more-than-one-session-by-chaining-method)

```
$session->set('name', 'Khalid')
        ->set('age', 19)
        ->set('country', 'Iraq')
        ->set('city', 'Baghdad');
```

#### Add more than one session by providing an array

[](#add-more-than-one-session-by-providing-an-array)

```
$session->set([
    'name' => 'khalid',
    'age' => 19,
    'location' => [
        'country' => 'iraq',
        'city' => 'baghdad'
    ]
]);
```

#### Get one session by key

[](#get-one-session-by-key)

```
$sesssion->get($key); // will use the default prefix.
```

#### Get All Session by spicefic prefix

[](#get-all-session-by-spicefic-prefix)

```
$session->fromPrefix($prefix);

#example
$session->fromPrefix('test'); // returns an array of all session that have a "test" prefix
```

#### Check if the session exists!

[](#check-if-the-session-exists)

```
Session::has($key); // returns True or False

#example
if(Session::has('is_loggin')) {
   // do something
} else {
   // do something else
}
```

#### Remove Session by key

[](#remove-session-by-key)

```
$sesssion->remove($key);
```

#### by chaining method

[](#by-chaining-method)

```
$session->remove('name')
        ->remove('age')
        ->remove('location');
```

#### by providing an array of keys

[](#by-providing-an-array-of-keys)

```
$session->remove([
    'name', 'age', 'location'
]);
```

#### or just like this

[](#or-just-like-this)

```
$session->remove('name', 'age', 'location');
```

#### Get the session id

[](#get-the-session-id)

```
$sesssion->id(); // will return the id of the session.
```

#### Regenerate the session id

[](#regenerate-the-session-id)

```
$sesssion->regenerate_id(); // will return the id of the session.
```

#### if you like to remove all session at one

[](#if-you-like-to-remove-all-session-at-one)

```
$session->destroy();
```

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 96.9% 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

2965d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/790c5d7b2b439f6a44b94237a96c29c3d2ae0d764360f8e9eeadc4df88012754?d=identicon)[prog98rammer](/maintainers/prog98rammer)

---

Top Contributors

[![khalidsheet](https://avatars.githubusercontent.com/u/22039209?v=4)](https://github.com/khalidsheet "khalidsheet (31 commits)")[![hsmfawaz](https://avatars.githubusercontent.com/u/16060516?v=4)](https://github.com/hsmfawaz "hsmfawaz (1 commits)")

---

Tags

oopphpphp-sessionsession

### Embed Badge

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

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

###  Alternatives

[wapmorgan/morphos

A morphological solution for Russian and English language written completely in PHP. Provides classes to inflect personal names, geographical names, decline and pluralize nouns, generate cardinal and ordinal numerals, spell out money amounts and time.

8351.3M7](/packages/wapmorgan-morphos)[mcp/sdk

Model Context Protocol SDK for Client and Server applications in PHP

1.4k423.9k30](/packages/mcp-sdk)[hackzilla/password-generator

Password Generator Library

3035.2M15](/packages/hackzilla-password-generator)[alibaba/nacos

阿里巴巴nacos配置中心php客户端

19340.8k1](/packages/alibaba-nacos)[bvdputte/kirby-fingerprint

Cache-busting utility to fingerprint assets (JS/CSS) in Kirby 3

1610.0k](/packages/bvdputte-kirby-fingerprint)

PHPackages © 2026

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