PHPackages                             croak-dbmanagement/dbmanagement - 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. croak-dbmanagement/dbmanagement

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

croak-dbmanagement/dbmanagement
===============================

a set of php objects and interfaces for a simple use of databases using PDO

1.02(8y ago)0511MITPHP

Since Oct 12Pushed 8y agoCompare

[ Source](https://github.com/20centcroak/DBManagement)[ Packagist](https://packagist.org/packages/croak-dbmanagement/dbmanagement)[ Docs](https://github.com/20centcroak/DBManagement)[ RSS](/packages/croak-dbmanagement-dbmanagement/feed)WikiDiscussions master Synced 2mo ago

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

DBManagement
============

[](#dbmanagement)

php classes to manage generic databases with pdo

With DbManagement, you just have to implements the DbManagement interface, extends the DbManagementObject and define queries according to the database type and then building tables or queryng is really simple.

use DbManagement thanks to composer : **composer require croak-dbmanagement/dbmanagement**

The DbManagement interface has to be implemented to deal with different kind of databases and then different syntaxes. The package  gives an implementation to deal with sqlite. If you use sqlite, use this package which calls the DbManagement package :

**composer require croak-sqlite-dbmanagement/sqlite-dbmanagement**

The DbManamgementObject needs the table fields definition. This is done thanks to 4 constant arrays that should be created in the class that extends DbManagementObject:

- KEYS\[key=&gt;value\] defines the field names of the table. The field names are all the values of the array. Values are string.
- KEY\_TYPES\[key=&gt;type\] define the field types associated to the field name thanks to the same key as the array KEYS. It may be one of the function used by php to test variable type (is\_string, is\_numeric, is\_int, is\_float, ...). and is then not dependent on the Database syntax. Types are string
- KEY\_REQUIRED\[key=&gt;required\] define wich fields are required when adding a record in the database. the "required" value is associated with the field name thanks to the same key as the array KEYS. Required are boolean.
- KEY\_UNIQUE\[key=&gt;unique\] define wich fields have to be unique when adding a record in the database. the "unique" value is associated with the field name thanks to the same key as the array KEYS. Unique are boolean.

abstract setter methods of DbManamgementObject should be filled in to return these constants

here is an example:

` use Croak\\DbManagement\\Exceptions\\IotException;

use Croak\\DbManagement\\DbManagementObject;

class Measure extends DbManagementObject{

```
const KEYS = array(
    "type"=>"type",
    "unit"=>"unit",
    "value"=>"value",
    "flag"=>"flag",
    "deviceSn"=>"id_device",
    "date"=>"created"
);

const KEY_TYPES = array(
    "type"=>"is_string",
    "unit"=>"is_string",
    "value"=>"is_float",
    "flag"=>"is_string",
    "deviceSn"=>"is_string",
    "date"=>"is_string"
);

const KEY_REQUIRED = array(
    "type"=>true,
    "unit"=>true,
    "value"=>true,
    "flag"=>false,
    "deviceSn"=>true,
    "date"=>true
);

 const KEY_UNIQUE = array(
    "type"=>false,
    "unit"=>false,
    "value"=>false,
    "flag"=>false,
    "deviceSn"=>false,
    "date"=>false
);

public function getKeys(){
    return constant("self::KEYS");
}

public function getTypes(){
    return constant("self::KEY_TYPES");
}

public function getRequiredKeys(){
    return constant("self::KEY_REQUIRED");
}

public function getUniqueKeys(){
    return constant("self::KEY_UNIQUE");
}

```

} `

It is as easy as this!

For querying with the GET verb, use the following keywords:

- \[fieldName\]-up pour trier les données par ordre ascendant sur le champ \[fieldName\]
- \[fieldName\]-down pour trier les données par ordre descendant sur le champ \[fieldName\]
- \[fieldName\]-min=XXX pour sélectionner les données telles que \[fieldName\]&gt;=XXX
- \[fieldName\]-max=XXX pour sélectionner les données telles que \[fieldName\]&lt;=XXX
- \[fieldName\]=XXX pour sélectionner les données telles que \[fieldName\]=XXX

Let assume that the route localhost:8080/measures is defined in your app and the fields named "value" and "flag" are defined in the database table, here is an example of a GET request :

localhost:8080/measures?value-min=12&amp;value-up&amp;flag-down

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity65

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

Total

3

Last Release

3131d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/3bc25511a1a2967d75b0521fc35fb219c3af9907c89f6b75ae43e5c76574fc34?d=identicon)[20centcroak](/maintainers/20centcroak)

---

Top Contributors

[![20centcroak](https://avatars.githubusercontent.com/u/23664172?v=4)](https://github.com/20centcroak "20centcroak (17 commits)")

---

Tags

databasemanagementphpdatabasepdo

### Embed Badge

![Health badge](/badges/croak-dbmanagement-dbmanagement/health.svg)

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

###  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)[ifsnop/mysqldump-php

PHP version of mysqldump cli that comes with MySQL

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

💾 Nette Database: layer with a familiar PDO-like API but much more powerful. Building queries, advanced joins, drivers for MySQL, PostgreSQL, SQLite, MS SQL Server and Oracle.

5656.7M231](/packages/nette-database)[dibi/dibi

Dibi is Database Abstraction Library for PHP

5013.8M120](/packages/dibi-dibi)[aura/sqlquery

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

4572.9M34](/packages/aura-sqlquery)[envms/fluentpdo

FluentPDO is a quick and light PHP library for rapid query building. It features a smart join builder, which automatically creates table joins.

925511.7k13](/packages/envms-fluentpdo)

PHPackages © 2026

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