PHPackages                             az13js/auto-inc-id - 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. az13js/auto-inc-id

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

az13js/auto-inc-id
==================

A PHP package to generate auto-incremented IDs using shared memory or file.

0.0.1(1y ago)08MITPHPPHP &gt;=7.4

Since Oct 17Pushed 1y ago1 watchersCompare

[ Source](https://github.com/az13js/auto-inc-id)[ Packagist](https://packagist.org/packages/az13js/auto-inc-id)[ RSS](/packages/az13js-auto-inc-id/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (2)Used By (0)

自增ID生成和获取工具
===========

[](#自增id生成和获取工具)

1. [Click here to view the English version of the README](README.en.md)
2. [点击这里查看中文版本的README](README.md)

PHP实现单机获取自增ID功能。使用方法：

一，先通过Composer安装源码：

```
composer require "az13js/auto-inc-id"
```

二，在代码中引入：

```
require __DIR__ . '/vendor/autoload.php';
```

三，使用：

```
// 获取自增ID（优先通过共享内存获取自增ID，如果没有则从环境变量AUTO_INC_ID_FILE设置的文件中获取自增ID）
echo 'get_auto_inc_id():' . PHP_EOL;
echo get_auto_inc_id() . PHP_EOL;

// 直接通过共享内存获取自增ID
echo 'get_auto_inc_id_shm():' . PHP_EOL;
echo get_auto_inc_id_shm() . PHP_EOL;

// 直接通过环境变量AUTO_INC_ID_FILE设置的文件中获取自增ID
echo 'get_auto_inc_id_file():' . PHP_EOL;
echo get_auto_inc_id_file() . PHP_EOL;
```

注意事项：

- 环境变量AUTO\_INC\_ID\_FILE用于从文件中获取自增ID，如果没有，尝试通过文件获取将会失败
- 获取自增ID的函数在失败时会返回`false`，不会抛出异常
- 配置环境变量AUTO\_INC\_ID\_DEBUG的值为任意布尔值为真的值时，开启调试模式，会通过标准错误输出调试信息

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance36

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity29

Early-stage or recently created project

 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

579d ago

### Community

Maintainers

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

---

Top Contributors

[![az13js](https://avatars.githubusercontent.com/u/20492037?v=4)](https://github.com/az13js "az13js (1 commits)")

### Embed Badge

![Health badge](/badges/az13js-auto-inc-id/health.svg)

```
[![Health](https://phpackages.com/badges/az13js-auto-inc-id/health.svg)](https://phpackages.com/packages/az13js-auto-inc-id)
```

###  Alternatives

[arara/process

Provides a better API to work with processes on Unix-like systems

16861.7k2](/packages/arara-process)[ezsystems/ezautosave-ls

Content editing autosave extension for eZ Publish legacy

22423.2k3](/packages/ezsystems-ezautosave-ls)[copyleaks/php-plagiarism-checker

Copyleaks detects online plagiarism and checks content distribution. Use Copyleaks to find out if textual content is original and where it has been used before. This package shows how to integrate with the Copyleaks cloud to search for copyright infringement.

5066.4k](/packages/copyleaks-php-plagiarism-checker)[teknomavi/tcmb

T.C. Merkez Bankası üzerinden güncel döviz kurlarını çeker

7019.2k](/packages/teknomavi-tcmb)[silverstripe/multiform

SilverStripe forms with multiple steps, flow control and state persistence

3156.0k3](/packages/silverstripe-multiform)[kinglozzer/multiselectfield

A sortable multiple select field for managing many-to-many relations

1341.2k2](/packages/kinglozzer-multiselectfield)

PHPackages © 2026

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