PHPackages                             ruesin/mysql - 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. ruesin/mysql

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

ruesin/mysql
============

MySQL utils classes

v0.0.1(7y ago)0104Apache-2.0PHP

Since Feb 16Pushed 6y ago1 watchersCompare

[ Source](https://github.com/ruesin/mysql-utils)[ Packagist](https://packagist.org/packages/ruesin/mysql)[ Docs](https://github.com/ruesin)[ RSS](/packages/ruesin-mysql/feed)WikiDiscussions master Synced 4d ago

READMEChangelogDependencies (2)Versions (3)Used By (0)

MySQL-Utils
===========

[](#mysql-utils)

基于[Medoo](https://github.com/catfan/Medoo)的单例类，没有对`Medoo`做任何修改，仅为了方便使用而加了层单例壳。

1. 使用`setConfig($name, $config)`加载配置到静态属性`$configs`中，`$name`为连接名，`$config`为连接选项参数
2. 使用`getInstance($name)`获取指定连接名`$name`的`\Medoo\Medoo`实例
3. 获取的即为`Medoo`实例，直接[使用](https://medoo.in/doc)即可

```
$configs = [
    'blog' => [
        'driver' => 'mysql',
        'host' => '127.0.0.1',
        'database' => 'blog',
        'username' => 'root',
        'password' => 'root',
        'port' => '3306',
        'retry_exception' => [
            // 'MySQL server has gone away'
        ]
    ],
    'web' => [
        'driver' => 'mysql',
        'host' => '127.0.0.1',
        'database' => 'web',
        'username' => 'root',
        'password' => 'root',
        'port' => '3306'
    ],
];
//加载配置到静态属性
foreach ($configs as $key => $config) {
    \Ruesin\Utils\MySQL::setConfig($key, $config);
}

//获取连接实例
$mysql = \Ruesin\Utils\MySQL::getInstance('blog');

//执行查询
$mysql->query("SELECT sleep(30);");
$mysql->query("SELECT sleep(10);");
\Ruesin\Utils\MySQL::getInstance('blog')->query("SELECT sleep(5);");

//关闭连接
\Ruesin\Utils\MySQL::close('blog');

//清除所有连接
\Ruesin\Utils\MySQL::clear();
```

###  Health Score

24

—

LowBetter than 31% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 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

2693d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/8240739?v=4)[ruesin](/maintainers/ruesin)[@ruesin](https://github.com/ruesin)

---

Top Contributors

[![ruesin](https://avatars.githubusercontent.com/u/8240739?v=4)](https://github.com/ruesin "ruesin (21 commits)")

---

Tags

mysqlutilsmedoo

### Embed Badge

![Health badge](/badges/ruesin-mysql/health.svg)

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

###  Alternatives

[doctrine/dbal

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

9.7k605.0M6.7k](/packages/doctrine-dbal)[kirschbaum-development/eloquent-power-joins

The Laravel magic applied to joins.

1.6k32.6M45](/packages/kirschbaum-development-eloquent-power-joins)[scienta/doctrine-json-functions

A set of extensions to Doctrine that add support for json query functions.

58825.9M53](/packages/scienta-doctrine-json-functions)[cytopia/mysqldump-secure

Secure mysqldump script with encryption, compression, logging, blacklisting and Nagios monitoring integration

1484.7k1](/packages/cytopia-mysqldump-secure)

PHPackages © 2026

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