PHPackages                             anker456/simple-pdo - 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. anker456/simple-pdo

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

anker456/simple-pdo
===================

A simple Pdo library for micro PHP framework

v1.0.0(6y ago)05MITPHP

Since May 3Pushed 6y ago1 watchersCompare

[ Source](https://github.com/anker456/simplePdo)[ Packagist](https://packagist.org/packages/anker456/simple-pdo)[ RSS](/packages/anker456-simple-pdo/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependenciesVersions (2)Used By (0)

simplePdo
=========

[](#simplepdo)

A simple Pdo library for micro PHP framework.
It can be done for CRUD. It support write and read are separation.

\##How to use

### import the package

[](#import-the-package)

`composer require anker456/simple-pdo`

\###Add below code in your bootstrap file (e.g. index.php):

```
use \Anker456\PDO\Model;

Model::config(require_once __DIR__ . '/app/config/db.php');

```

The config file db.php like:

```
return [
    'host' => '127.0.0.1',
    'port' => 3306,
    'dbname' => 'mysql_test',
    'options' => null,
    'username' => 'root',
    'password' => '',
];

```

If your write and read database is different.You can config like:

```
return [
    'read' => [
        [
            'host' => '127.0.0.1',
            'port' => 3307,
            'dbname' => 'mysql_test',
            'options' => null,
            'username' => 'root',
            'password' => '',
        ],
        [
            'host' => '127.0.0.1',
            'port' => 3308,
            'dbname' => 'mysql_test',
            'options' => null,
            'username' => 'root',
            'password' => '',
        ]
    ],
    'write' => [
        [
            'host' => '127.0.0.1',
            'port' => 3306,
            'dbname' => 'mysql_test',
            'options' => null,
            'username' => 'root',
            'password' => '',
        ]
    ]
];

```

Please note that the write and read are existing meanly. If you use write,you must use read. The write and read can be same.
可以读写分离，只是必须读和写的节点必须同时存在，可以相同。

\##Add a model file (e.g. Users.php)
The model should and only inherit Anker456\\PDO\\Model. You do not need to code anything more. So it is simple.

```
namespace App;
use Anker456\PDO\Model;
/**
 * Class User
 * @package App
 */
class User extends Model
{
}

```

And then your controller can use the user model. You can see the demo/UserController.php. e.g.

```
$sql = "select * from users where id = ?";
$conditions = [$id];
$result = User::first($sql, $conditions);
var_dump($result);

```

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity55

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

2199d ago

### Community

Maintainers

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

---

Top Contributors

[![lizengcai888](https://avatars.githubusercontent.com/u/201916860?v=4)](https://github.com/lizengcai888 "lizengcai888 (1 commits)")

### Embed Badge

![Health badge](/badges/anker456-simple-pdo/health.svg)

```
[![Health](https://phpackages.com/badges/anker456-simple-pdo/health.svg)](https://phpackages.com/packages/anker456-simple-pdo)
```

###  Alternatives

[doctrine/orm

Object-Relational-Mapper for PHP

10.2k285.3M6.2k](/packages/doctrine-orm)[jdorn/sql-formatter

a PHP SQL highlighting library

3.9k115.1M102](/packages/jdorn-sql-formatter)[illuminate/database

The Illuminate Database package.

2.8k52.4M9.4k](/packages/illuminate-database)[mongodb/mongodb

MongoDB driver library

1.6k64.0M546](/packages/mongodb-mongodb)[ramsey/uuid-doctrine

Use ramsey/uuid as a Doctrine field type.

90340.3M211](/packages/ramsey-uuid-doctrine)[reliese/laravel

Reliese Components for Laravel Framework code generation.

1.7k3.4M16](/packages/reliese-laravel)

PHPackages © 2026

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