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

ActiveLibrary

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 4d 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 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity46

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

1544d 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

[laravel/framework

The Laravel Framework.

34.6k509.9M17.0k](/packages/laravel-framework)[phpoffice/phpspreadsheet

PHPSpreadsheet - Read, Create and Write Spreadsheet documents in PHP - Spreadsheet engine

13.9k293.5M1.3k](/packages/phpoffice-phpspreadsheet)[maatwebsite/excel

Supercharged Excel exports and imports in Laravel

12.7k144.3M712](/packages/maatwebsite-excel)[cakephp/cakephp

The CakePHP framework

8.8k18.5M1.6k](/packages/cakephp-cakephp)[illuminate/contracts

The Illuminate Contracts package.

704122.9M10.1k](/packages/illuminate-contracts)[algolia/algoliasearch-client-php

API powering the features of Algolia.

69333.0M114](/packages/algolia-algoliasearch-client-php)

PHPackages © 2026

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