PHPackages                             antonkalmykov/session-muscle - 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. antonkalmykov/session-muscle

ActiveLibrary

antonkalmykov/session-muscle
============================

Session provider component for ITCourses Jazz Framework

v1.0.0(10y ago)023MITPHPPHP &gt;=5.5.9

Since Feb 16Pushed 10y ago1 watchersCompare

[ Source](https://github.com/kalmykovanton/SessionMuscle)[ Packagist](https://packagist.org/packages/antonkalmykov/session-muscle)[ Docs](https://github.com/kalmykovanton/SessionMuscle.git)[ RSS](/packages/antonkalmykov-session-muscle/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (2)Used By (0)

SessionMuscle
=============

[](#sessionmuscle)

Session provider component for ITCourses Jazz Framework

How to use:
-----------

[](#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:

63073ae80b786fdc21bb7616a54d25615e6c8f28**short** - name of short session

or 27s45ae80b987fsc22bs4576v54d25615w6c8f28**long** - 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:

```
// settings array
$settings = [
    // cookie name which will store the session id
    'cookieName' => 'sess',
    // session entity to record logs
    'sessLogName' => '.sesslog',
    // session repository in this case be folder,
    // generally it can be any
    'repository' => 'storage/sessions',
    // through a gap to run the garbage collector
    'runRate' => 10,
    // short session lifetime in seconds
    'short' => 60,
    // long session lifetime in seconds
    'long' => 120
];
```

Then, create adapter which will be responsible for maintaining sessions (in this example, this is adapter who stored sessions into files):

```
use SessionMuscle\Adapters\FileAdapter;
$adapter = new FileAdapter();
```

And now you can create session instance, first argument is session adapter instance, second - session settings:

```
use SessionMuscle\Session;
$session = new Session($adapter, $settings);
```

SessionMuscle API
-----------------

[](#sessionmuscle-api)

Retrieve all data from the session:

```
$session->all(); // return array of session data
```

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:

```
$session->get($key, $default = ''); // return session data or default value
```

Add new data to current session:

```
$session->put($key, $value); // return true on success
```

Check if an item exists in the session:

```
$session->has($key); // return true if key exists or false if no
```

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:

```
$session->pull($key, $default = ''); // return session data or default value.
```

Remove a piece of data from the session by given key:

```
$session->delete($key, $default = ''); // true on successful removal or false if no
```

To get current session ID with session type (if exists), use:

```
$session->getSessID(); // current session ID with session type
```

To get current repository, use:

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

To get current session cookie name, use:

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

To get used session types, use:

```
$session->getSessionTypes(); // return array of session types
```

To get current session type, use:

```
$session->getSessionType(); // return current session type
```

To set type of current session, use:

```
$session->setSessionType($sessionType);
```

To get current session settings, use:

```
$session->getSessionSettings(); // return current session settings array
```

To save current session, use:

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

To regenerate current session, use:

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

To completely remove current session, use:

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

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity58

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

3736d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/0d1734f2ea6b3bd9745e277c1f5f85ddbbe256a8d7cf502e81dee6ab42aea206?d=identicon)[kalmykovanton](/maintainers/kalmykovanton)

---

Top Contributors

[![kalmykovanton](https://avatars.githubusercontent.com/u/12529715?v=4)](https://github.com/kalmykovanton "kalmykovanton (11 commits)")

### Embed Badge

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

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

PHPackages © 2026

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