PHPackages                             tonychen/php-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. tonychen/php-db

ActiveLibrary

tonychen/php-db
===============

php pdo library

v0.1.2(8y ago)0401PHPPHP &gt;=5.4

Since Jun 7Pushed 7y agoCompare

[ Source](https://github.com/TonyChen-SH/php-db)[ Packagist](https://packagist.org/packages/tonychen/php-db)[ RSS](/packages/tonychen-php-db/feed)WikiDiscussions develop Synced 3d ago

READMEChangelog (2)Dependencies (2)Versions (5)Used By (1)

### 数据库类库

[](#数据库类库)

> 基于slim-pdo做的一个pdo数据库类

[![StyleCI](https://camo.githubusercontent.com/4003df1e6d3b325f922890cdb7f65a2ec0c3dbf339de03c54bf21d31c84c59dc/68747470733a2f2f7374796c6563692e696f2f7265706f732f39323537373033332f736869656c643f6272616e63683d6d6173746572)](https://styleci.io/repos/92577033)[![Build Status](https://camo.githubusercontent.com/fb99f99db2f452a2228d85581ae380056cdd83ef5b33c54282af5abce86f19b8/68747470733a2f2f7472617669732d63692e6f72672f546f6e794368656e2d53482f7068702d64622e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/TonyChen-SH/php-db)

### Install

[](#install)

```
$ composer require tonychen/php-db
```

```
  // 把下面的代码片段，加入到composer.json文件里面
  "require": {
    "tonychen/php-db": "0.1"
  }
```

### Usage

[](#usage)

```
require_once 'vendor/autoload.php';

$pdo = \Tony\DB\DbFactory::getInstance(['dsn' => 'mysql:host=192.168.1.11;dbname=test;charset=utf8','user'=>'root', 'password' => '123456']);

// 使用原生
$res = $pdo->fetchRow('SELECT * FROM player');

//------------------------使用sql builder---------------------------//

// SELECT * FROM users WHERE id = ?
$selectStatement = $pdo->select()
                       ->from('users')
                       ->where('id', '=', 1234);

$stmt = $selectStatement->execute();
$data = $stmt->fetch();

// INSERT INTO users ( id , usr , pwd ) VALUES ( ? , ? , ? )
$insertStatement = $pdo->insert(array('id', 'usr', 'pwd'))
                       ->into('users')
                       ->values(array(1234, 'your_username', 'your_password'));

$insertId = $insertStatement->execute(false);

// UPDATE users SET pwd = ? WHERE id = ?
$updateStatement = $pdo->update(array('pwd' => 'your_new_password'))
                       ->table('users')
                       ->where('id', '=', 1234);

$affectedRows = $updateStatement->execute();

// DELETE FROM users WHERE id = ?
$deleteStatement = $pdo->delete()
                       ->from('users')
                       ->where('id', '=', 1234);

$affectedRows = $deleteStatement->execute();
```

### [slim-pdo documentation](https://github.com/FaaPz/Slim-PDO/tree/master/docs)

[](#slim-pdo-documentation)

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity51

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

Every ~169 days

Total

3

Last Release

2926d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/6cefbbef4fcf3c3f570b20878c5b89c6ae869bcfbcbe95e6807c55eace7bf785?d=identicon)[TonyChen-SH](/maintainers/TonyChen-SH)

---

Top Contributors

[![TonyChen-SH](https://avatars.githubusercontent.com/u/27392605?v=4)](https://github.com/TonyChen-SH "TonyChen-SH (10 commits)")

###  Code Quality

TestsCodeception

### Embed Badge

![Health badge](/badges/tonychen-php-db/health.svg)

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

PHPackages © 2026

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