PHPackages                             sinri/sinri-database-agent - 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. sinri/sinri-database-agent

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

sinri/sinri-database-agent
==========================

Provide a old-style alike quick SQL handler for PHP.

0.6(9y ago)012MITPHPPHP &gt;=5.4.0

Since Mar 22Pushed 9y ago1 watchersCompare

[ Source](https://github.com/sinri/sinri-database-agent)[ Packagist](https://packagist.org/packages/sinri/sinri-database-agent)[ Docs](https://github.com/sinri/sinri-database-agent)[ RSS](/packages/sinri-sinri-database-agent/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (5)DependenciesVersions (6)Used By (0)

SinriDatabaseAgent
==================

[](#sinridatabaseagent)

[![Packagist Version Badge](https://camo.githubusercontent.com/7cb6bf2c281f44618d3f5774aa9af8ee680213c037058c07d056e54627562901/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f73696e72692f73696e72692d64617461626173652d6167656e742e737667)](https://camo.githubusercontent.com/7cb6bf2c281f44618d3f5774aa9af8ee680213c037058c07d056e54627562901/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f73696e72692f73696e72692d64617461626173652d6167656e742e737667)[![Packagist](https://camo.githubusercontent.com/6646b468951417712a7f26fa0b006a99596c5253e2625ea7402e7febcb373672/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f73696e72692f73696e72692d64617461626173652d6167656e742e737667)](https://camo.githubusercontent.com/6646b468951417712a7f26fa0b006a99596c5253e2625ea7402e7febcb373672/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f73696e72692f73696e72692d64617461626173652d6167656e742e737667)[![Packagist](https://camo.githubusercontent.com/cfa3d745cc1c67c2657ed948898f53622ada7c4191f48acd31ecf39e54096b79/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f73696e72692f73696e72692d64617461626173652d6167656e742e737667)](https://camo.githubusercontent.com/cfa3d745cc1c67c2657ed948898f53622ada7c4191f48acd31ecf39e54096b79/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f73696e72692f73696e72692d64617461626173652d6167656e742e737667)

Provide a old-style alike quick SQL handler for PHP. With this toolkit developers could be free from writing fundamental code for database.

Composer
--------

[](#composer)

```
composer require sinri/sinri-database-agent

```

Usage
-----

[](#usage)

1. Include the `autoload.php` into your PHP project.
2. Declare what you need for convenience.

```
// PDO
use sinri\SinriDatabaseAgent\SinriPDO;
$db=new SinriPDO($params);
// MySQLi
use sinri\SinriDatabaseAgent\SinriMySQLi;
$db=new SinriMySQLi($params);
```

3. General Method

If the following SQL `SELECT X,Y FROM T WHERE KEY>0;`refers to this records:

  KEY X Y   1 x1 y1   2 x2 y2 ```
$sql="SELECT X,Y FROM T WHERE KEY>0;";

$db->getAll($sql);
// return [["X"=>"x1","Y"=>"y1"],["X"=>"x2","Y"=>"y2"]]

$db->getRow($sql);
// return ["X"=>"x1","Y"=>"y1"]

$db->getCol($sql);
// return ["x1","x2"]

$db->getOne($sql);
// return "x1"
```

If you need to do some modification.

```
$sql="INSERT INTO...";
$db->insert($sql);
// return the last inserted record's PK value.

$sql="UPDATE ...";// or DELETE, etc.
$db->exec($sql);
// return affected row count, or FALSE on failure.
```

You may want to use transactions.

```
$db->beginTransaction();

// do some work

$db->inTransaction();
// return if this line is in transaction

if($has_error){
    $db->rollBack();
}else{
    $db->commit();
}
```

For Developers
--------------

[](#for-developers)

- Use Code Rule `PSR2`, just run `./PSR2.sh` before commit and push if `phpcs` and `phpcbf` is correctly installed.
- Run `php test/test.php` to do Unit Test after correcting `test\config.php` settings.

### Check

[](#check)

```
phpcs --report=full --standard=PSR2 --ignore=vendor .
phpcs --report=summary --standard=PSR2 --ignore=vendor .

```

### Correct

[](#correct)

```
phpcbf --report=full --standard=PSR2 --ignore=vendor .

```

License
-------

[](#license)

SinriDatabaseAgent is published under MIT License.

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

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

Every ~0 days

Total

5

Last Release

3341d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/5821330?v=4)[Everstray Jun Sinri Edogawa](/maintainers/sinri)[@sinri](https://github.com/sinri)

---

Top Contributors

[![sinri](https://avatars.githubusercontent.com/u/5821330?v=4)](https://github.com/sinri "sinri (12 commits)")

---

Tags

phpdatabasesql

### Embed Badge

![Health badge](/badges/sinri-sinri-database-agent/health.svg)

```
[![Health](https://phpackages.com/badges/sinri-sinri-database-agent/health.svg)](https://phpackages.com/packages/sinri-sinri-database-agent)
```

###  Alternatives

[ifsnop/mysqldump-php

PHP version of mysqldump cli that comes with MySQL

1.3k5.5M69](/packages/ifsnop-mysqldump-php)[clouddueling/mysqldump-php

PHP version of mysqldump cli that comes with MySQL

1.3k22.9k](/packages/clouddueling-mysqldump-php)[butschster/dbml-parser

DBML (database markup language) parser written on PHP8.

6416.8k2](/packages/butschster-dbml-parser)[friedolinfoerder/wp-activerecord

An ActiveRecord implementation for WordPress

237.2k](/packages/friedolinfoerder-wp-activerecord)

PHPackages © 2026

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