PHPackages                             test-lin/db - 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. test-lin/db

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

test-lin/db
===========

database

v1.0.0(7y ago)08MITPHPPHP &gt;=7.0.0

Since Oct 31Pushed 7y ago1 watchersCompare

[ Source](https://github.com/test-lin/db)[ Packagist](https://packagist.org/packages/test-lin/db)[ RSS](/packages/test-lin-db/feed)WikiDiscussions master Synced 2w ago

READMEChangelogDependenciesVersions (3)Used By (0)

数据库
===

[](#数据库)

环境
--

[](#环境)

- php &gt;= 7.0
- mysqli 或 pdo 支持
- composer

配置
--

[](#配置)

```
$config = [
    'db_type' => 'mysqli', // mysqli or pdo
    'mysqli' => [
        'host' => '127.0.0.1',
        'port' => 3306,
        'username' => 'root',
        'password' => 'root',
        'dbname' => 'test'
    ],
    'pdo' => [
        'host' => '127.0.0.1',
        'port' => 3306,
        'username' => 'root',
        'password' => 'root',
        'dbname' => 'test'
    ]
];
```

操作
--

[](#操作)

所有驱动均支持以下方法

- select(String $sql);
    说明：查询多条数据
    参数：执行的 sql
    返回：查询成功，返回 二维数组数据；否则返回 false；
- find(String $sql);
    说明：查询一条数据
    参数：执行的 sql
    返回：查询成功，返回 关联数组数据；否则返回 false；
- getField(String $sql, String $field = null);
    说明：取一个字段的值
    参数：执行的 sql，指定字段
    返回：查询成功，返回 字段数据；否则返回 false；
- insert(String $table, array $data);
    说明：添加数据到数据表
    参数：表名，添加到数据库的数据
    返回：bool
- update(String $table, array $data, $where);
    说明：更新数据表数据
    参数：表名，要修改的数据，条件
    返回：bool
- delete(String $table, $where);
    说明：删除数据表数据
    参数：表名，条件
    返回：bool
- beginTransaction();
    说明：开启事务
    返回：null
- rollback();
    说明：事务回滚
    返回：null
- commit();
    说明：提交事务
    返回：null

实例
--

[](#实例)

```
$db_type = $config['db_type'];
$db = new Testlin\Db\Db($db_type, $config[$db_type]);
```

###  Health Score

25

—

LowBetter than 35% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity58

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

2586d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/12641322?v=4)[Jani](/maintainers/test-lin)[@test-lin](https://github.com/test-lin)

---

Top Contributors

[![test-lin](https://avatars.githubusercontent.com/u/12641322?v=4)](https://github.com/test-lin "test-lin (13 commits)")

### Embed Badge

![Health badge](/badges/test-lin-db/health.svg)

```
[![Health](https://phpackages.com/badges/test-lin-db/health.svg)](https://phpackages.com/packages/test-lin-db)
```

###  Alternatives

[jdorn/sql-formatter

a PHP SQL highlighting library

3.8k117.8M121](/packages/jdorn-sql-formatter)[backup-manager/backup-manager

A framework agnostic database backup manager with user-definable procedures and support for S3, Dropbox, FTP, SFTP, and more with drivers for popular frameworks.

1.7k1.6M11](/packages/backup-manager-backup-manager)[propel/propel1

Propel is an open-source Object-Relational Mapping (ORM) for PHP5.

8351.6M88](/packages/propel-propel1)[insolita/yii2-migration-generator

Set of gii tools for generating files for migration by schema of table , phpdoc or table data

108508.0k5](/packages/insolita-yii2-migration-generator)[xpdo/xpdo

A PDO-based Object/Relational Bridge Library

7088.4k4](/packages/xpdo-xpdo)[coryrose/livewire-tables

An extension for Livewire that allows you to effortlessly scaffold datatables with optional pagination, search, and sort.

8941.5k](/packages/coryrose-livewire-tables)

PHPackages © 2026

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