PHPackages                             dtmind/dtpdo - 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. dtmind/dtpdo

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

dtmind/dtpdo
============

DTPDO class

1.0.0(8y ago)114MITPHPPHP &gt;=5.3.0

Since Aug 7Pushed 8y ago1 watchersCompare

[ Source](https://github.com/DTMind/DTPDO)[ Packagist](https://packagist.org/packages/dtmind/dtpdo)[ Docs](http://www.dtmind.com/dtpdo/)[ RSS](/packages/dtmind-dtpdo/feed)WikiDiscussions master Synced yesterday

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

DTPDO
=====

[](#dtpdo)

Extends php PDO functions and let you create CRUD query with arrays.

Let's explain functions by exampes.

In order to do our examples we need a table ...

```
CREATE TABLE IF NOT EXISTS `user` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
      `name` varchar(25) NOT NULL,
      `surname` varchar(25) NOT NULL,
      `age` int(11) NOT NULL,
      `city` varchar(25) NOT NULL,
      PRIMARY KEY (`id`)
    ) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=4 ;

INSERT INTO `user` (`id`, `name`, `surname`, `age`, `city`) VALUES
(1, 'John', 'Smith', 32, 'Boston'),
(2, 'James', 'Brown', 39, 'New York'),
(3, 'Robert', 'Wilson', 52, 'Washington');

```

... and a instance of the class in a php file.

```

```

insertRecord
------------

[](#insertrecord)

`insertRecord($table, $param)`: Insert a record in a table by a given array of values

- param string $table: table name
- param array $param: associative array ("field1" =&gt; "value 1", ..., "fieldn" =&gt; "value n")

##### example #1

[](#example-1)

```

```

updateRecord
------------

[](#updaterecord)

`updateRecord($table, $param, $key)`: Update a record in a table by a ginen array

- param string $table: table name
- param array $param: associative array ("field1" =&gt; "value 1", ..., "fieldn" =&gt; "value n")
- param string/array $key

##### example #2

[](#example-2)

```

```

getValue
--------

[](#getvalue)

`getValue($query, $fetchMode = PDO::FETCH_NUM)`: Get a value from a given query

- param string $query
- param string $fetchMode = PDO::FETCH\_NUM
- return string : value of the first field of the first row

##### example #3

[](#example-3)

Code:

```

```

Function result:

```
Brown

```

getValues
---------

[](#getvalues)

`getValues($query, $fetchMode = PDO::FETCH_NUM)`: Get an array of values from a given query

- param type $query
- param string $fetchMode = PDO::FETCH\_NUM
- return array : vector of values of the query of the first row

##### example #4

[](#example-4)

Code:

```

```

Function result (array):

```
Array(
    id => 2
    name => James
    surname => Brown
    age => 39
    city => New York
);

```

getListValue
------------

[](#getlistvalue)

`getListValue($query, $index = 1)`: Get an array of value, index is the first field of the query, value is the second field of the query

- param string $query
- param $index = 1, "1" array key is the first value of the quesry, "0" array key is incremental
- return array

##### example #5

[](#example-5)

Code: the index is the id value

```

```

Function result (array):

```
Array(
    2 => James
    3 => Robert
);

```

##### example #6

[](#example-6)

Code: the index is an incremental value

```

```

Function result (array):

```
Array(
    0 => James
    1 => Robert
);

```

getListValues
-------------

[](#getlistvalues)

`getListValues($query, $fetchMode = PDO::FETCH_NUM, $index = 0)`: Get an array of array, index is the first field of the query, array contains all the fields of the query

- param string $query
- param $fetchMode = PDO::FETCH\_NUM
- param $index = 1, "1" array key is the first value of the quesry, "0" array key is incremental
- return array

##### example #7

[](#example-7)

Code: the array as an incremental index

```

```

Function result (array):

```
Array(
    0=> Array(
        0 => 1
        1 => John
        2 => Smith
        3 => 32
        4 => Boston
    );
    1=> Array(
        0 => 2
        1 => James
        2 => Brown
        3 => 39
        4 => New York
    );
    2=> Array(
        0 => 3
        1 => Robert
        2 => Wilson
        3 => 52
        4 => Washington
    );
);

```

##### example #8

[](#example-8)

Code: the first value is the key of the array

```

```

Function result (array):

```
Array(
    1=> Array(
        id => 1
        name => John
        surname => Smith
        age => 32
        city => Boston
    );
    2=> Array(
        id => 2
        name => James
        surname => Brown
        age => 39
        city => New York
    );
    3=> Array(
        id => 3
        name => Robert
        surname => Wilson
        age => 52
        city => Washington
    );
);

```

prepareInsertQuery
------------------

[](#prepareinsertquery)

`prepareInsertQuery($table, $param)`: Prepare an insert query by a ginen array

- param string $table: table name
- param array $param: associative array ("field1" =&gt; "value 1", ..., "fieldn" =&gt; "value n")
- return array(query,values)

prepareUpdateQuery
------------------

[](#prepareupdatequery)

`prepareUpdateQuery($table, $param, $key)`: Prepare an update query by a given array

- param string $table: table name
- param array $param: associative array ("field1" =&gt; "value 1", ..., "fieldn" =&gt; "value n")
- param string/array $key: table key
- return array(query,values)

FAQ
===

[](#faq)

License
-------

[](#license)

The MIT License (MIT)

Website
-------

[](#website)

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

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

3201d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/316fc69569a2df2507989922dcd799f939871694de5db366d99f8fc949a527d6?d=identicon)[DTMind](/maintainers/DTMind)

---

Top Contributors

[![DTMind](https://avatars.githubusercontent.com/u/6401510?v=4)](https://github.com/DTMind "DTMind (66 commits)")

---

Tags

pdomodel

### Embed Badge

![Health badge](/badges/dtmind-dtpdo/health.svg)

```
[![Health](https://phpackages.com/badges/dtmind-dtpdo/health.svg)](https://phpackages.com/packages/dtmind-dtpdo)
```

###  Alternatives

[doctrine/dbal

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

9.7k578.4M5.6k](/packages/doctrine-dbal)[spatie/laravel-translatable

A trait to make an Eloquent model hold translations

2.4k23.0M413](/packages/spatie-laravel-translatable)[spatie/eloquent-sortable

Sortable behaviour for eloquent models

1.5k22.9M268](/packages/spatie-eloquent-sortable)

PHPackages © 2026

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