PHPackages                             kaduamaral/connectionpdo - 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. kaduamaral/connectionpdo

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

kaduamaral/connectionpdo
========================

The ConnectionPDO is a database connection class

1.1.1(8y ago)218111MITPHPPHP &gt;=5.5.33

Since May 31Pushed 8y ago1 watchersCompare

[ Source](https://github.com/KaduAmaral/ConnectionPDO)[ Packagist](https://packagist.org/packages/kaduamaral/connectionpdo)[ Docs](https://github.com/KaduAmaral/ConnectionPDO)[ RSS](/packages/kaduamaral-connectionpdo/feed)WikiDiscussions master Synced 4w ago

READMEChangelog (4)DependenciesVersions (5)Used By (1)

ConnectionPDO
=============

[](#connectionpdo)

ConnectionPDO é uma classe PHP para realizar a gestão do banco de dados de uma forma mais prática.

\##Version

1.1.0

Methods
-------

[](#methods)

- [Drop](#drop)
- [Create](#create)
- [Insert](#insert)
- [Update](#update)
- [Delete](#delete)
- [Select](#select)
- ExecuteSQL (generic query)
- [Transaction](#insert) (Begin, Rollback, Commit)

Exemplo
-------

[](#exemplo)

### Conexão

[](#conexão)

```
$host = 'localhost';
$user = 'root';
$pass = '';
$base = 'test';

$con = new ConnectionPDO($host,$user,$pass,$base);
```

### DROP

[](#drop)

```
$con->drop('tab_teste');
```

### CREATE

[](#create)

```
$fields = Array(
      'id' => Array(
         'type' => 'int',
         'size' => '4',
         'comment' => 'first key'
      ),
      'name' => Array(
         'type' => 'varchar',
         'size' => '60',
         'comment' => 'test name'
      ),
      'col3' => Array(
         'type' => 'varchar',
         'size' => '60',
         'default' => NULL,
         'comment' => 'test name'
      )
   );
   $con->create('tab_teste',$fields,'id','InnoDB',false);
```

O quinto parâmetro é para eliminar a tabela, se existir.

### INSERT

[](#insert)

```
$data = Array('id'=>1,'name' => 'First Record', 'col3' => 'test ');
$con->insert('tab_teste',$data);

$data = Array('id'=>2,'name' => 'Second Record', 'col3' => 'test ');
$con->insert('tab_teste',$data);

$data = Array('id'=>3,'name' => 'Third Record', 'col3' => 'test ');
$con->insert('tab_teste',$data);
```

### DELETE

[](#delete)

```
$where = Array('id'=>1);
$con->delete('tab_teste', $where);
```

### UPDATE

[](#update)

```
$data = Array(
   'name' => 'Now this is the first record',
   'col3' => 'First record'
);
$where = Array('id'=>2);
$con->update('tab_teste',$data, $where);
```

### SELECT

[](#select)

```
$where = Array('id' => Array('BETWEEN'=>Array(2,3)));
$res = $con->select('tab_teste',$where);
$tab = $res->fetch(PDO::FETCH_ASSOC);
```

**Resultado do select:**

```
------------------------------------------------------
| id | name                           | col3         |
------------------------------------------------------
| 2  | Now this is the first record   | First record |
------------------------------------------------------
| 3  | Third Record                   | test         |
------------------------------------------------------

```

### WHERE

[](#where)

Alguns exemplos do parâmetro `$where`:

```
$where = 'id = 1';
// Resultado: id = 1

$where = Array('id' => 1);
// Resultado: id = 1

$where = Array('id' => 1,'$OR1'=>'OR','col3' => 'test');
// Resultado: id = 1 OR col3 = 'test'

$where - Array('col3' => array('LIKE' => 'recor'))
// Resultado: col3 LIKE '%recor%'

$where = Array('id' => Array(1,'>>>',10, Array(3,6,8)));
// Resultado: id IN (1,2,4,5,7,9,10)

$where = Array('id' => Array('BETWEEN' => Array(1,10)));
// Resultado:  id BETWEEN 1 AND 10

$where = Array('id' => Array('NOT' => Array(1,2,3,12,45)));
// Resultado: id NOT IN (1,2,3,12,45)

$where = Array('id' => Array('NOT' => Array(1,'>>>',10, Array(3,6,8))));
// Resultado: id NOT IN (1,2,4,5,7,9,10)

$where = Array(
  'id' => array('NOT' => array(1,'>>>',6,array(3,5))),
  '$OR'=>'OR',
  'col3' => array('LIKE' => 'recor')
);
// Resultado: id NOT IN (1, 2, 4, 6) OR col3 LIKE '%recor%'
```

Para inserir algo entre colunas basta passar um parâmetro iniciando com `$` seguido de qualquer *string*:

```
$where = Array('id'=>3, '$a'=>'OR', 'name'=>Array('LIKE'=>'first'))
```

Também pode passar operadores como `>`, `>=`, ` 'valor'`:

```
$where = Array('id >'=>1)
// Resultado: id > 1
```

Outro exemplo:

```
$where = Array(
   'id >' => 5,
   '$1'=>'OR',
   '$2'=>'(',
   'col3' => array('LIKE' => 'recor'),
   '$3'=>'OR',
   'name' => array('LIKE' => 'Recor'),
   '$4'=>')'
);
// Resultado: `id` > 5 OR  ( `col3` LIKE '%recor%' OR `name` LIKE '%Recor%' )
```

Licença
-------

[](#licença)

Distribuição sob licença MIT

Projeto
-------

[](#projeto)

[Author: Kaduamaral](http://linkedin.com/in/kaduamaral)

[Author Blog: Devcia](http://devcia.com/)

###  Health Score

29

—

LowBetter than 57% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity61

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

Total

4

Last Release

2961d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/e98ab5d3d18bc90f2f77bef7d47c26af21d54fc8bb20a5489944a35cf9a73228?d=identicon)[kaduamaral](/maintainers/kaduamaral)

---

Top Contributors

[![KaduAmaral](https://avatars.githubusercontent.com/u/4316607?v=4)](https://github.com/KaduAmaral "KaduAmaral (19 commits)")

---

Tags

pdoConnection

### Embed Badge

![Health badge](/badges/kaduamaral-connectionpdo/health.svg)

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

###  Alternatives

[doctrine/dbal

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

9.7k595.8M6.5k](/packages/doctrine-dbal)[atlas/pdo

Provides a PDO instance decorator with convenience methods, and a connection manager.

18262.4k8](/packages/atlas-pdo)

PHPackages © 2026

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