PHPackages                             augusl/laravel-tidb - 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. [Database &amp; ORM](/categories/database)
4. /
5. augusl/laravel-tidb

ActiveLibrary[Database &amp; ORM](/categories/database)

augusl/laravel-tidb
===================

Laravel database driver for PingCAP TiDB

v1.0(1y ago)06Apache-2.0PHPPHP &gt;=8

Since Mar 20Pushed 1y agoCompare

[ Source](https://github.com/augusl/laravel-tidb)[ Packagist](https://packagist.org/packages/augusl/laravel-tidb)[ RSS](/packages/augusl-laravel-tidb/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (3)Versions (2)Used By (0)

laravel-tidb
============

[](#laravel-tidb)

Laravel database driver for [TiDB](https://github.com/pingcap/tidb)

Requirements
------------

[](#requirements)

- PHP &gt;= 7.4
- Laravel 6 ~ 10
- TiDB &gt;= 4.0

Installation
------------

[](#installation)

Install via composer

```
composer require colopl/laravel-tidb
```

That's all. You can use database connection as usual.

Features
--------

[](#features)

- Added `autoRandom($shard_bits = null)` to `ColumnDefinition`
- When user defines `$table->id()` in the migration file, it will add `PRIMARY KEY AUTO_RANDOM` to the schema instead of `PRIMARY KEY AUTO_INCREMENT` so that data gets distributed evenly.
- Added Support for nested transactions (MySQL driver will throw an exception)
- Added Support for adding/dropping multiple columns (MySQL driver will throw an exception)

Unsupported features
--------------------

[](#unsupported-features)

1. Nesting transactions and then rolling them back will always rollback to the first transaction since `SAVEPOINT` is not supported by TiDB. In other words, rolling back with `$connection->rollBack()` will always rollback level to `0`.
2. Adding and dropping multiple columns atomically is not fully supported. Defining multiple columns in migrations is supported but will be executed one by one and will not be atomic. Ex: `$table->dropColumn('title', 'content')`

For unsupported features for TiDB itself, please see [MySQL Compatibility](https://docs.pingcap.com/tidb/stable/mysql-compatibility).

### Testing

[](#testing)

You can run tests on docker by the following command.

```
make test
```

License
-------

[](#license)

Apache 2.0 - See [LICENSE](./LICENSE) for more information.

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance46

Moderate activity, may be stable

Popularity4

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity37

Early-stage or recently created project

 Bus Factor1

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

418d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/47f026fa940f93fa71b9e19e0b575293365824649f2d4dd15a429179721b237e?d=identicon)[augusl](/maintainers/augusl)

---

Top Contributors

[![taka-oyama](https://avatars.githubusercontent.com/u/748854?v=4)](https://github.com/taka-oyama "taka-oyama (41 commits)")[![dulao5](https://avatars.githubusercontent.com/u/689799?v=4)](https://github.com/dulao5 "dulao5 (5 commits)")[![augusl](https://avatars.githubusercontent.com/u/25142251?v=4)](https://github.com/augusl "augusl (4 commits)")[![Uyan712](https://avatars.githubusercontent.com/u/20490656?v=4)](https://github.com/Uyan712 "Uyan712 (2 commits)")[![zeriyoshi](https://avatars.githubusercontent.com/u/10289597?v=4)](https://github.com/zeriyoshi "zeriyoshi (2 commits)")[![halnique](https://avatars.githubusercontent.com/u/10358623?v=4)](https://github.com/halnique "halnique (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/augusl-laravel-tidb/health.svg)

```
[![Health](https://phpackages.com/badges/augusl-laravel-tidb/health.svg)](https://phpackages.com/packages/augusl-laravel-tidb)
```

###  Alternatives

[anourvalar/eloquent-serialize

Laravel Query Builder (Eloquent) serialization

11320.2M21](/packages/anourvalar-eloquent-serialize)[overtrue/laravel-versionable

Make Laravel model versionable.

585308.0k5](/packages/overtrue-laravel-versionable)[abbasudo/laravel-purity

elegant way to add filter and sort in laravel

514330.5k1](/packages/abbasudo-laravel-purity)[statamic-rad-pack/runway

Eloquently manage your database models in Statamic.

135192.6k5](/packages/statamic-rad-pack-runway)[dragon-code/laravel-deploy-operations

Performing any actions during the deployment process

240173.5k2](/packages/dragon-code-laravel-deploy-operations)[stayallive/laravel-eloquent-observable

Register Eloquent model event listeners just-in-time directly from the model.

2928.9k7](/packages/stayallive-laravel-eloquent-observable)

PHPackages © 2026

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