PHPackages                             shijianzhiwai/medoo - 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. shijianzhiwai/medoo

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

shijianzhiwai/medoo
===================

The lightest PHP database framework to accelerate development

v1.5.4(8y ago)124MITPHPPHP &gt;=5.4

Since Apr 28Pushed 8y ago1 watchersCompare

[ Source](https://github.com/shijianzhiwai/Medoo)[ Packagist](https://packagist.org/packages/shijianzhiwai/medoo)[ Docs](https://medoo.in)[ RSS](/packages/shijianzhiwai-medoo/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependenciesVersions (27)Used By (0)

说明
--

[](#说明)

基于Medoo二次开发的数据库组件，用于支持阿里云的数据库的读写分离设定，支持更多的Raw写法。

安装
--

[](#安装)

```
composer require shijianzhiwai/medoo:1.5.4a
```

新增语法
----

[](#新增语法)

```
$db = new \Medoo\Medoo([
    'database_type' => 'mysql',
    'database_name' => 'test',
    'server'        => '127.0.0.1',
    'username'      => 'root',
    'password'      => '123456',
    'charset'       => 'utf8',
    'port'          => 3306,
]);

//阿里云RDS读写分离下强制主库查询
$db->forceMaster()->select('test', '*', ['id' => 1]);

//新增的RAW写法 select 部分新增自定义select字段部分
//生成的语句 /*FORCE_MASTER*/SELECT `id` as asName FROM `test` WHERE `id` = 1
$db->forceMaster()->select('test', \Medoo\Medoo::raw('`id` as asName'),  ['id' => 1]);
```

测试
--

[](#测试)

测试数据库：

```
[
    'database_type' => 'mysql',
    'database_name' => 'test',
    'server'        => '127.0.0.1',
    'username'      => 'root',
    'password'      => '123456',
    'charset'       => 'utf8',
    'port'          => 3306,
]
```

```
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
--  Table structure for `test`
-- ----------------------------
DROP TABLE IF EXISTS `test`;
CREATE TABLE `test` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `value` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=14 DEFAULT CHARSET=latin1;

SET FOREIGN_KEY_CHECKS = 1;
```

```
cd Medoo
phpunit
```

License
-------

[](#license)

Medoo is under the MIT license.

Links
-----

[](#links)

- Official website:
- Documentation:

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity68

Established project with proven stability

 Bus Factor1

Top contributor holds 92.6% 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 ~58 days

Recently: every ~24 days

Total

25

Last Release

2994d ago

Major Versions

v0.9.8 → v1.02015-10-05

PHP version history (2 changes)v0.9.5.3PHP &gt;=5.1

v1.2PHP &gt;=5.4

### Community

Maintainers

![](https://www.gravatar.com/avatar/40a112b5304a2b4077eae00060f48eca5c6e78fcd293162ee4345ec0dfd7110b?d=identicon)[shijianzhiwai](/maintainers/shijianzhiwai)

---

Top Contributors

[![catfan](https://avatars.githubusercontent.com/u/1467904?v=4)](https://github.com/catfan "catfan (398 commits)")[![Angelaon](https://avatars.githubusercontent.com/u/13937887?v=4)](https://github.com/Angelaon "Angelaon (15 commits)")[![qatrix](https://avatars.githubusercontent.com/u/1537121?v=4)](https://github.com/qatrix "qatrix (5 commits)")[![IfnotFr](https://avatars.githubusercontent.com/u/1242308?v=4)](https://github.com/IfnotFr "IfnotFr (3 commits)")[![utopiaio](https://avatars.githubusercontent.com/u/2365328?v=4)](https://github.com/utopiaio "utopiaio (2 commits)")[![indiwine](https://avatars.githubusercontent.com/u/5175217?v=4)](https://github.com/indiwine "indiwine (2 commits)")[![jackled](https://avatars.githubusercontent.com/u/2091208?v=4)](https://github.com/jackled "jackled (1 commits)")[![glenndavey83](https://avatars.githubusercontent.com/u/6992344?v=4)](https://github.com/glenndavey83 "glenndavey83 (1 commits)")[![r0manchak](https://avatars.githubusercontent.com/u/4974042?v=4)](https://github.com/r0manchak "r0manchak (1 commits)")[![SyuTingSong](https://avatars.githubusercontent.com/u/680340?v=4)](https://github.com/SyuTingSong "SyuTingSong (1 commits)")[![amoydavid](https://avatars.githubusercontent.com/u/734190?v=4)](https://github.com/amoydavid "amoydavid (1 commits)")

---

Tags

databasemysqlsqlitepostgresqlmariadbsqlmssqloraclelightweightphp framework

### Embed Badge

![Health badge](/badges/shijianzhiwai-medoo/health.svg)

```
[![Health](https://phpackages.com/badges/shijianzhiwai-medoo/health.svg)](https://phpackages.com/packages/shijianzhiwai-medoo)
```

###  Alternatives

[catfan/medoo

The lightweight PHP database framework to accelerate development

4.9k1.5M194](/packages/catfan-medoo)[doctrine/dbal

Powerful PHP database abstraction layer (DBAL) with many features for database schema introspection and management.

9.7k578.4M5.6k](/packages/doctrine-dbal)[tommyknocker/pdo-database-class

Framework-agnostic PHP database library with unified API for MySQL, MariaDB, PostgreSQL, SQLite, MSSQL, and Oracle. Query Builder, caching, sharding, window functions, CTEs, JSON, migrations, ActiveRecord, CLI tools, AI-powered analysis. Zero external dependencies.

845.7k](/packages/tommyknocker-pdo-database-class)[ramadan/easy-model

A Laravel package for enjoyably managing database queries.

101.6k](/packages/ramadan-easy-model)

PHPackages © 2026

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