PHPackages                             stnc/pdo-database - 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. stnc/pdo-database

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

stnc/pdo-database
=================

A super simple function that returns the full SQL query from your PDO statements

2.2.4(7y ago)2100[4 issues](https://github.com/stnc/pdo-database/issues)[1 PRs](https://github.com/stnc/pdo-database/pulls)MITPHPPHP &gt;=5.4.0

Since Aug 6Pushed 5y ago1 watchersCompare

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

READMEChangelog (1)DependenciesVersions (17)Used By (0)

pdo-database
============

[](#pdo-database)

easy ,basic ,simple mysql provider
A super simple function that returns the full SQL query from your PDO statements
a PDO database service provider for mysql and portgreSQL

Composer install
================

[](#composer-install)

composer require stnc/pdo-database

1. Installing-Connections
-------------------------

[](#1-installing-connections)

```
require_once 'vendor/autoload.php';
  define('DB_TYPE', 'mysql');
  define('DB_HOST', 'localhost');
  define('DB_NAME', 'wordpress');
  define('DB_USER', 'root');
  define('DB_PASS', '');
```

2. Connections
--------------

[](#2-connections)

```
/* //use 1
use Stnc\Db\MysqlAdapter ;
$db = new MysqlAdapter();
*/

/* //use 2
use Stnc\Db\MysqlAdapter as dbs;
$db = new dbs();
*/

//use 3
$db = new Stnc\Db\MysqlAdapter();
$tableName = 'users';
```

3. Select multiple rows
-----------------------

[](#3-select-multiple-rows)

```
$q = "SELECT * FROM ".$tableName;
$array_expression = $db->fetchAll ( $q );
foreach ( $array_expression as $value ) {
	echo  $value ['name'];
	echo '';
}
```

4. Select single row
--------------------

[](#4-select-single-row)

```
$tableName = 'wp_options';//wordpress
$q = "SELECT * FROM ".$tableName;
$array_expression = $db->fetch ( $q );
echo $array_expression ['name'];
//or
$q = 'SELECT * FROM '.$tableName.' where option_name="siteurl" ';
$array_expression = $db->fetch ( $q );
print_r ($array_expression);
echo $array_expression ['option_name'];
```

5. Query
--------

[](#5--query)

```
$q = "ALTER TABLE users MODIFY COLUMN user_id  int(11) NOT NULL AUTO_INCREMENT FIRST";
$db->query ( $q );
```

6. insert data
--------------

[](#6-insert-data)

```
$data = array (
		'name' => "john",
		'lastname' => "carter",
		'status' => 1,
		'age' => 25
);

$db->insert ( $tableName, $data );
```

7. update metod
---------------

[](#7-update-metod)

```
$data = array (
		'name' => "john",
		'lastname' => "carter",
		'status' => 1,
		'age' => 25
);
$where = array (
		'user_id' => 1
);
$db-> update ( $tableName, $data, $where );
```

8. Delete metod
---------------

[](#8-delete-metod)

```
$where = array (
		'user_id' => 1
);

return $db->delete ( $tableName, $where );
```

9. last id
----------

[](#9-last-id)

```
$db->lastID();
```

10. Orm Mass Updates
--------------------

[](#10-orm-mass-updates)

```
$db->tableName=$tableName;
$db->where('id', '=', 1)->update2(['username' =>'selman sedat']);
```

###  Health Score

24

—

LowBetter than 31% of packages

Maintenance0

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity66

Established project with proven stability

 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 ~91 days

Recently: every ~147 days

Total

16

Last Release

2618d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/3958405?v=4)[ TUNC Sam](/maintainers/stnc)[@stnc](https://github.com/stnc)

---

Top Contributors

[![stnc](https://avatars.githubusercontent.com/u/3958405?v=4)](https://github.com/stnc "stnc (85 commits)")

---

Tags

composermetodmysqlpdopdo-databasephpmysqlsqlpdo

### Embed Badge

![Health badge](/badges/stnc-pdo-database/health.svg)

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

###  Alternatives

[doctrine/dbal

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

9.7k605.0M6.5k](/packages/doctrine-dbal)[ifsnop/mysqldump-php

PHP version of mysqldump cli that comes with MySQL

1.3k5.8M75](/packages/ifsnop-mysqldump-php)[aura/sqlquery

Object-oriented query builders for MySQL, Postgres, SQLite, and SQLServer; can be used with any database connection library.

4563.1M37](/packages/aura-sqlquery)[clouddueling/mysqldump-php

PHP version of mysqldump cli that comes with MySQL

1.3k23.1k](/packages/clouddueling-mysqldump-php)[ezsql/ezsql

Advance database access library. Make interacting with a database ridiculously easy. An universal interchangeable CRUD system.

86748.3k](/packages/ezsql-ezsql)[jv2222/ezsql

Advance database access library. Make interacting with a database ridiculously easy. An universal interchangeable CRUD system.

86811.4k2](/packages/jv2222-ezsql)

PHPackages © 2026

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