PHPackages                             hakuryo/database-client - 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. hakuryo/database-client

ActiveLibrary

hakuryo/database-client
=======================

A simple database client with a lot a helper function

3.0.0(9mo ago)139111MITPHPPHP &gt;=8.4

Since May 31Pushed 9mo ago1 watchersCompare

[ Source](https://github.com/CaptainClaquette/composer-database-client)[ Packagist](https://packagist.org/packages/hakuryo/database-client)[ RSS](/packages/hakuryo-database-client/feed)WikiDiscussions main Synced 1w ago

READMEChangelogDependencies (2)Versions (23)Used By (1)

Patch Note
----------

[](#patch-note)

### 2.1.0

[](#210)

#### feature

[](#feature)

- Add trackBy param to search function. This param will replace the auto index key of the array by the value of the key for the corresponding line.

exemple:

```
$db = ConnectionDB::fromFile("my_file",'mydb');
$res = $db->search(request:"SELECT id,name,mail from user",trackBy:"mail");
print_r($res);
// Will ouptut something like this with id = 1 name=toto and mail=toto@domaine.fr
Array
(
  ["toto@domaine.fr"] => stdClass Object
  (
      [id] => 1
      [name] => toto
      [mail] => toto@domaine.fr
  )
)
```

### 2.0.0 (Breaking changes)

[](#200-breaking-changes)

#### feature

[](#feature-1)

- Add callback param to "get" and "search" to act on lines when they are read.
- Add property lastRowCount to store last UPDATE/INSERT/DELETE rowCount
- Function bindValues now affect SQL type on "boolean","string","int","null" param where preparing a query.

#### change

[](#change)

- Now require php8.1 or above
- Now require hakuryo/config-parser
- Changing naming convention from snake\_case to camelCase
- Removing internal class ConfigParser to use hakuryo/config-parser instead
- Removing query type checks for "get","modify","search" function

#### fix

[](#fix)

- Some optimization when reading database results

### 1.5.0

[](#150)

- Add CHARSET param to config parser.
- removing default utf8 charset for mysql. you must now use CHARSET config param.

### 1.4.3

[](#143)

- Fix Forcing utf8 queries for dblib driver

### 1.4.2

[](#142)

- Update composer.json for php8+ compatibility

### 1.4.1

[](#141)

- Fix space in oci / dblib dsn build

### 1.4.0

[](#140)

- Add call function to preform SQL procedure calls

### 1.3.0

[](#130)

- Refactoring ConfigParser
    - Add support for `pgsl` and `dblib` drivers
    - Now checking if provided driver is installed with PDO::getAvailableDrivers function

### 1.2.1

[](#121)

- Allowed "Truncate" keyword in modify request.

### 1.2.0

[](#120)

- Add $classname param to search and get function. If set, these function will return database line as $classname object. (POD::FETCH\_CLASS)

### 1.1.0 (Breaking changes)

[](#110-breaking-changes)

- Remove $assoc variable from fucntion **search**,**get**,**modify**. Theses function now detect automatically if provided array is associative or not.

Install
-------

[](#install)

> composer require hakuryo/database-client

Dependencies
------------

[](#dependencies)

### Mandatory

[](#mandatory)

- PHP &gt;= 7.x

### Optionnal

[](#optionnal)

> Only If you want to use ConnectionDB to connect to an ORACLE database

- Oracle Instantclient
- PHP PDO\_OCI
- php-sybase
- php-pgsql

Features
--------

[](#features)

- Parsing client config from INI and JSON file

Usage &amp; exemples
--------------------

[](#usage--exemples)

### Exemple INI file

[](#exemple-ini-file)

```
[mysql]
HOST = "localhost"
DB = mydb
USER = "root"
PWD = "mypass"
PORT = 1234
DRIVER = "mysql" ;Accepted Values are oci,mysql,dblib,pgsl

[oracle]
HOST = "localhost"
DB = mydb
USER = "root"
PWD = "mypass"
PORT = 1234
DRIVER = "oci" ;Accepted Values are oci,mysql,dblib,pgsl
CHARSET = UTF8
```

### Exemple JSON file

[](#exemple-json-file)

```
{
  "db": {
    "DB": "mydb",
    "HOST": "localhost",
    "USER": "root",
    "PWD": "mypass",
    "PORT": 3306,
    "DRIVER": "mysql"
  },
  "db2": {
    "DB": "mydb",
    "HOST": "localhost",
    "USER": "root",
    "PWD": "mypass",
    "PORT": 3306,
    "DRIVER": "mysql",
    "CHARSET": "UTF-8"
  }
}
```

### ConnectionDB usage

[](#connectiondb-usage)

```
require "./vendor/autoload.php";

use hakuryo\db\ConnectionDB;
//Connection to mysql
$db = ConnectionDB::fromFile('config.ini', 'mysql');
//Usage of anonnymous params
$rq = "SELECT * FROM users";
// search function is for multiple result
print_r($db->search($rq, [1234]));
$db =null;

//Connection to oracle
$db = ConnectionDB::fromFile('config.ini', 'oracle');
$rq = "SELECT firstname FROM users WHERE id = :id";
//Usage of named params
// get function return the first line of the result
$result = $db->get($rq, ["id"=>1234]);

// Check if result is relevant
if($result !== null){
var_dump($result);
}
$db =null;

//Connection with a config.ini without section
$db = ConnectionDB::fromFile('config_without_section.ini');
$rq = "INSERT INTO users (firstname,lastname) VALUES (:fname,:lname)";
//Modify is use to perform update, insert or delete operation
print_r($db->modify($rq, ["fname"=>"Bob","lname"=>"Moran"]));
$db =null;
```

###  Health Score

44

—

FairBetter than 92% of packages

Maintenance56

Moderate activity, may be stable

Popularity17

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity79

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

Recently: every ~48 days

Total

22

Last Release

293d ago

Major Versions

1.5.0 → 2.0.02025-01-03

2.1.5 → 3.0.02025-07-29

PHP version history (5 changes)1.0.0PHP &gt;=7.0.0

1.3.2PHP ^7

1.4.2PHP &gt;=7.0

2.0.0PHP &gt;=8.1

3.0.0PHP &gt;=8.4

### Community

Maintainers

![](https://www.gravatar.com/avatar/482cf0225f97ddd58cb99a0123baeae3aba471ccdbf61904de4c49167af19af2?d=identicon)[Hakuryo](/maintainers/Hakuryo)

---

Top Contributors

[![CaptainClaquette](https://avatars.githubusercontent.com/u/10845062?v=4)](https://github.com/CaptainClaquette "CaptainClaquette (32 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/hakuryo-database-client/health.svg)

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

PHPackages © 2026

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