PHPackages                             lengbin/sub-table - 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. lengbin/sub-table

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

lengbin/sub-table
=================

sub table

0172PHP

Since Dec 1Pushed 3y ago1 watchersCompare

[ Source](https://github.com/ice-leng/sub-table)[ Packagist](https://packagist.org/packages/lengbin/sub-table)[ RSS](/packages/lengbin-sub-table/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

sub-table
=========

[](#sub-table)

简单分表

Install
-------

[](#install)

The preferred way to install this extension is through [composer](http://getcomposer.org/download/).

Either run

```
composer require lengbin/sub-table

```

or add

```
"lengbin/sub-table": "*"

```

to the require section of your `composer.json` file.

Use date

```
$tableName = "t_user_log";
$pdo = new PDO();
$subTable = (new SubTableFactory)->make(SubTableMode::DATE())
$subTable->setKey(date('Y'));
// $this->subTable->suffix(); // 根据生成后缀
$this->subTable->setPdo($pdo); // 设置 pdo
$this->subTable->createSubTable($tableName); // 生成分表
```

Use hash

```
$tableName = "t_user_log";
$pdo = new PDO();
$subTable = (new SubTableFactory)->make(SubTableMode::HASH())
$subTable->setKey(1234);
$subTable->setSlices("32"); // 设置 分片 默认 10
// $this->subTable->suffix(); // 根据hash 求余 生成后缀
$this->subTable->setPdo($pdo); // 设置 pdo
$this->subTable->createSubTable($tableName); // 生成分表
```

###  Health Score

17

—

LowBetter than 6% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity24

Early-stage or recently created project

 Bus Factor1

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

### Community

Maintainers

![](https://www.gravatar.com/avatar/9342ed631e7bf15897f2e15d0a853800b84cb315e601eb3a58f2cc8938b5d011?d=identicon)[ice.leng](/maintainers/ice.leng)

---

Top Contributors

[![olsai](https://avatars.githubusercontent.com/u/73751177?v=4)](https://github.com/olsai "olsai (6 commits)")[![ice-leng](https://avatars.githubusercontent.com/u/7506787?v=4)](https://github.com/ice-leng "ice-leng (1 commits)")

### Embed Badge

![Health badge](/badges/lengbin-sub-table/health.svg)

```
[![Health](https://phpackages.com/badges/lengbin-sub-table/health.svg)](https://phpackages.com/packages/lengbin-sub-table)
```

###  Alternatives

[jakewhiteley/php-sets

An implementation of a Java-like Set data structure for PHP. A Set is an iterable data structure which allows strict-type storage of unique values.

1827.5k](/packages/jakewhiteley-php-sets)[marciocamello/yii2-x-editable

X-editable extensions for Yii 2, based in X-editable with Bootstrap

228.8k2](/packages/marciocamello-yii2-x-editable)

PHPackages © 2026

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