PHPackages                             tufanbarisyildirim/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. tufanbarisyildirim/laravel-tidb

ActiveLibrary

tufanbarisyildirim/laravel-tidb
===============================

TiDB Grammar lib for Laravel

30PHP

Since Dec 2Pushed 5y ago1 watchersCompare

[ Source](https://github.com/tufanbarisyildirim/laravel-tidb)[ Packagist](https://packagist.org/packages/tufanbarisyildirim/laravel-tidb)[ RSS](/packages/tufanbarisyildirim-laravel-tidb/feed)WikiDiscussions master Synced 2d ago

READMEChangelogDependenciesVersions (1)Used By (0)

Laravel TiDB
============

[](#laravel-tidb)

TiDB is a distributed database that supports MySQL Protocol. It already works with most of mysql-compatible libs/tools. However it does not support some MySQL features like foreign keys, xml and json queries etc.

The goal is to change queries on the fly to make them compatible with TiDB before hitting to database.

> it is currently under development and it just supports DDLs (so it works well for your migrations)
>
> if you are using TiDB with laravel in production and you already faced some of them and fixed, awesome, just open a PR!

Installa using Composer
-----------------------

[](#installa-using-composer)

```
composer require tufanbarisyildirim/laravel-tidb

```

What you need to change for better support
------------------------------------------

[](#what-you-need-to-change-for-better-support)

\-- Todo: explain how should a developer write migrations and rollbacks.

Current Progress
----------------

[](#current-progress)

This library aims to provide some workarounds to keep your laravel app working with TiDB. But a single developer can't guarantee to get the all done. I will solve every situation I face in my own projects.

### DDL Incompatibility.

[](#ddl-incompatibility)

In TiDB, all supported DDL changes are performed online. Compared with DDL operations in MySQL, the DDL operations in TiDB have the following major restrictions:

- Multiple operations cannot be completed in a single ALTER TABLE statement. For example, it is not possible to add multiple columns or indexes in a single statement. Otherwise, the Unsupported multi schema change error might be output.
- \[wontfix\] Different types of indexes `(HASH|BTREE|RTREE|FULLTEXT)` are not supported, and will be parsed and ignored when specified.
- \[wontfix\] Adding/Dropping the primary key is unsupported unless alter-primary-key is enabled.
- Changing the field type to its superset is unsupported. For example, TiDB does not support changing the field type from `INTEGER` to `VARCHAR`, or from `TIMESTAMP` to DATETIME. Otherwise, the error information Unsupported modify column: type `%d` not match origin `%d `might be output.
- Change/Modify data type does not currently support "lossy changes", such as changing from `BIGINT` to `INT`.
- Change/Modify decimal columns does not support changing the precision.
- Change/Modify integer columns does not permit changing the UNSIGNED attribute.
- The `ALGORITHM={INSTANT,INPLACE,COPY}` syntax functions only as an assertion in TiDB, and does not modify the ALTER algorithm. See ALTER TABLE for further details.
- \[wontfix\] Table Partitioning supports Hash, Range, and Add/Drop/Truncate/Coalesce. The other partition operations are ignored. The Warning: Unsupported partition type, treat as normal table error might be output. The following Table Partition syntaxes are not supported:
- PARTITION BY LIST
- PARTITION BY KEY
- SUBPARTITION
- {`CHECK|EXCHANGE|TRUNCATE|OPTIMIZE|REPAIR|IMPORT|DISCARD|REBUILD|REORGANIZE`} PARTITION

### Limitations of SELECT syntax

[](#limitations-of-select-syntax)

- The SELECT ... INTO @variable syntax is not supported.
- The SELECT ... GROUP BY ... WITH ROLLUP syntax is not supported.

Some more unsupported features
==============================

[](#some-more-unsupported-features)

[TiDB Mysql Compatibility](https://docs.pingcap.com/tidb/v3.0/mysql-compatibility)

This lib does not solve the following unsupported features since TiDB does not support yet.

- Stored procedures and functions
- Triggers
- Events
- User-defined functions
- FOREIGN KEY constraints #18209
- Temporary tables #1248
- FULLTEXT/SPATIAL functions and indexes #1793
- Character sets other than utf8, utf8mb4, ascii, latin1 and binary
- SYS schema
- Optimizer trace
- XML Functions
- X-Protocol #1109
- Savepoints #6840
- Column-level privileges #9766
- XA syntax (TiDB uses a two-phase commit internally, but this is not exposed via an SQL interface)
- CREATE TABLE tblName AS SELECT stmt syntax #4754
- CHECK TABLE syntax #4673
- CHECKSUM TABLE syntax #1895
- GET\_LOCK and RELEASE\_LOCK functions #14994

###  Health Score

17

—

LowBetter than 6% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity31

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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/6deb6aeaee50e977a23bd48c820eeced342db604f0cf95da3f1aaa54ded62725?d=identicon)[tufan](/maintainers/tufan)

---

Top Contributors

[![tufanbarisyildirim](https://avatars.githubusercontent.com/u/980848?v=4)](https://github.com/tufanbarisyildirim "tufanbarisyildirim (7 commits)")

### Embed Badge

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

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

PHPackages © 2026

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