PHPackages                             reaway/think-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. reaway/think-session

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

reaway/think-session
====================

think session

v1.0.2(4y ago)0352Apache-2.0PHPPHP &gt;=7.2.0

Since Feb 4Pushed 4y ago1 watchersCompare

[ Source](https://github.com/reaway/think-session)[ Packagist](https://packagist.org/packages/reaway/think-session)[ Docs](https://github.com/reaway/think-session)[ RSS](/packages/reaway-think-session/feed)WikiDiscussions main Synced 3w ago

READMEChangelog (3)Dependencies (3)Versions (4)Used By (2)

think-session
=============

[](#think-session)

安装
--

[](#安装)

```
composer require reaway/think-session
```

用法
--

[](#用法)

file驱动方式

```
use Think\Component\Session\Facade\Session;

require __DIR__ . DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php';

Session::setConfig([
    // session name
    'name' => 'PHPSESSID',
    // SESSION_ID的提交变量,解决flash上传跨域
    'var_session_id' => '',
    // 驱动方式 支持file cache
    'type' => 'file',
    // 过期时间
    'expire' => 1440,
    // 前缀
    'prefix' => '',

    // SESSION保存目录
    'path' => __DIR__ . DIRECTORY_SEPARATOR . 'session'
]);
Session::init();

Session::set('key', 'value');
Session::set('key1', 'value1');

Session::save();

var_dump(Session::get('key'));
var_dump(Session::all());
```

cache驱动方式

```
composer require reaway/think-cache
```

```
use Think\Component\Session\Facade\Session;
use Think\Component\Cache\Facade\Cache;

require __DIR__ . DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php';

Cache::setConfig([
    'default' => 'file',
    'stores' => [
        'file' => [
            'type' => 'File',
            // 缓存保存目录
            'path' => __DIR__ . DIRECTORY_SEPARATOR . 'cache' . DIRECTORY_SEPARATOR,
            // 缓存前缀
            'prefix' => '',
            // 缓存有效期 0表示永久缓存
            'expire' => 0,
        ],
        'redis' => [
            'type' => 'redis',
            'host' => '127.0.0.1',
            'port' => 6379,
            'prefix' => '',
            'expire' => 0,
        ],
    ],
]);
bind('Psr\SimpleCache\CacheInterface', 'Think\Component\Cache\Cache');

Session::setConfig([
    // session name
    'name' => 'PHPSESSID',
    // SESSION_ID的提交变量,解决flash上传跨域
    'var_session_id' => '',
    // 驱动方式 支持file cache
    'type' => 'cache',
    // 过期时间
    'expire' => 1440,
    // 前缀
    'prefix' => ''
]);
Session::init();

Session::set('key', 'value');
Session::set('key1', 'value1');

Session::save();

var_dump(Session::get('key'));
var_dump(Session::all());
```

文档
--

[](#文档)

详细参考 [Session处理](https://www.kancloud.cn/manual/thinkphp6_0/1037635)

###  Health Score

23

—

LowBetter than 26% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity47

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

Every ~8 days

Total

3

Last Release

1592d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/d342ebe348631bdfbe41ebcd414f0b5fa2334027d413e3543afb301f3503a13f?d=identicon)[reaway](/maintainers/reaway)

---

Top Contributors

[![reaway](https://avatars.githubusercontent.com/u/60423559?v=4)](https://github.com/reaway "reaway (9 commits)")

### Embed Badge

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

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

###  Alternatives

[mobiledetect/mobiledetectlib

Mobile\_Detect is a lightweight PHP class for detecting mobile devices. It uses the User-Agent string combined with specific HTTP headers to detect the mobile environment.

10.7k170.9M521](/packages/mobiledetect-mobiledetectlib)[illuminate/contracts

The Illuminate Contracts package.

706130.3M13.2k](/packages/illuminate-contracts)[civicrm/civicrm-core

Open source constituent relationship management for non-profits, NGOs and advocacy organizations.

751291.4k40](/packages/civicrm-civicrm-core)[flow-php/etl

PHP ETL - Extract Transform Load - Abstraction

378604.0k99](/packages/flow-php-etl)[phiki/phiki

Syntax highlighting using TextMate grammars in PHP.

3693.8M51](/packages/phiki-phiki)[moonshine/moonshine

Laravel administration panel

1.3k253.1k79](/packages/moonshine-moonshine)

PHPackages © 2026

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