PHPackages                             restu/dbhelper - 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. restu/dbhelper

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

restu/dbhelper
==============

package library for help you to use database

1.1.0(5y ago)015MITPHPPHP &gt;=7.0

Since Apr 1Pushed 5y ago1 watchersCompare

[ Source](https://github.com/KodeRestu/dbhelper)[ Packagist](https://packagist.org/packages/restu/dbhelper)[ RSS](/packages/restu-dbhelper/feed)WikiDiscussions master Synced 1w ago

READMEChangelogDependenciesVersions (4)Used By (0)

Salam Hormat
============

[](#salam-hormat)

Halo, mohon untuk di coba dbhelper php yang saya buat, semoga bisa membantu dalam kode kamu.

~Terima Kasih

Cara Pakai
----------

[](#cara-pakai)

Lihat Index.php untuk implementasi

### 1. Install &amp; Config

[](#1-install--config)

##### 1.1 copy or clone dbhelper ke app kamu.

[](#11-copy-or-clone-dbhelper-ke-app-kamu)

```
//if use composer
composer require restu/dbhelper
```

##### 1.2 config koneksi database di folder /config file db.json.

[](#12-config-koneksi-database-di-folder-config-file-dbjson)

```
di folder /dbhelper/config file db.json.
```

### 2. Buat Table Class

[](#2-buat-table-class)

buat table class sesuai database / tabel kamu didalam folder /dbhelper/dbclass

```
//table class must use namespace dbhelper & extends from _tbl
namespace dbhelper;

class Tbl extends _tbl{
    protected $_tbl = 'tbl';
    protected $_pk = 'id'; //must have primary key

    //define fields
    protected $_fields = [
      'id' => null
      ,'namatest'  => null
      ,"info" => null
    ];

}
```

### 3. required \_dbloader.php or autoload vendor composer

[](#3-required-_dbloaderphp-or-autoload-vendor-composer)

require \_dbloader.php atau autoload vendor composer di atas dokumen php kamu agar bantuan database / tabel bisa di panggil

```
require ("dbhelper/_dbloader.php");

//if use composer
require_once __DIR__ . '/vendor/autoload.php';

//your folder app need this
-- Your App Folder
  --- dbhelper
      --config
        --db.json //your connection to database
      --dbclass
        --Tbl.php //your tbl class
```

### 4. Intansiasi Tabel

[](#4-intansiasi-tabel)

Instansiasi tabel yang diperlukan dengan new dbhelper\\Tbl()

```
//with new dbhelper\;
$tbl = new dbhelper\Tbl();
```

### 5. Good luck &amp; Have fun with your app

[](#5-good-luck--have-fun-with-your-app)

##### 5.1 Create

[](#51-create)

###### 5.1.1 Insert 1

[](#511-insert-1)

$tbl-&gt;insert(associativeArray)

```
$argsInsert = [
     "namatest" => "nilai"
    ,"info" => "nilai record yang di insert"
];

$tbl -> insert($argsInsert);
```

###### 5.1.2 Insert 2

[](#512-insert-2)

one by one set value field then call $tbl -&gt; new();

```
$tbl -> setValue("namatest", "nilai" ); //field name, value record
$tbl -> setValue("info", "nilai record yang di insert");
$tbl -> new();
```

##### 5.2 Update

[](#52-update)

###### 5.2.1 Update 1

[](#521-update-1)

by primary keys value

```
$argsUpdate = [
  "namatest" => "nilai Update"
  ,"info" => "nilai record yang di update edit"
];

$tbl -> update('1',$argsUpdate);
```

###### 5.2.2 Update 2

[](#522-update-2)

by filter

```
$argsWhereFilter = [
  "namatest" => "nilai Update"
];

$argsUpdate = [
  "namatest" => "nilai Update"
  ,"info" => "nilai record yang di update edit"
];

$tbl -> updateBy($argsWhereFilter,$argsUpdate);
```

##### 5.3 Delete

[](#53-delete)

###### 5.3.1 Delete 1

[](#531-delete-1)

by primary keys value

```
$tbl -> delete('1');
```

###### 5.3.2 Delete 2

[](#532-delete-2)

by filter

```
$argsDeleteFilter = [
  "namatest" => "nilaid"
];

$tbl -> deleteBy($argsDeleteFilter);
```

##### 5.4 Get

[](#54-get)

Get only get one data and add to fields table

###### 5.4.1 Get 1

[](#541-get-1)

get by keys arrays by primary key

```
$record = $tbl -> get(['5']);
```

###### 5.4.2 Get 2

[](#542-get-2)

if you have other unique value can use getBy

```
$tbl -> getBy('field','value');
$record = $tbl -> getBy('id','4');
```

##### 5.5 Query

[](#55-query)

even you can query many data

```
$records = $tbl -> query("id,namatest,info",[
                                          "namatest='nilai'"
                                          //," and "
                                          //,"id = '5'"
                                        ]);
```

### 6. Other Feature

[](#6-other-feature)

##### 6.1 Get Next Number

[](#61-get-next-number)

```
$number = $tbl -> nextno("id");
echo $number;

$number = $tbl -> nextno("id", ["namatest='nilaidf'"]);
echo $number;
```

##### 6.2 encrypt &amp; verify value field

[](#62-encrypt--verify-value-field)

```
$tbl -> encrypt("namatest", "realvalue");
echo $tbl -> value("namatest");

//verify value field will return 1 if verified
$isVerify = $tbl -> verify("namatest", "realvalue");
echo $isVerify;
```

##### 6.3 time

[](#63-time)

```
$time = $tbl -> timeNow();
echo $time;
```

##### 6.4 setvalue &amp; unset field

[](#64-setvalue--unset-field)

```
$tbl->setValue("infodsf",7);
$tbl->unset(["infodsf"]);
echo $tbl->value("infodsf");
```

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity49

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

Every ~7 days

Total

2

Last Release

1863d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/71215342?v=4)[Restu Adi](/maintainers/koderestu)[@KodeRestu](https://github.com/KodeRestu)

---

Top Contributors

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

---

Tags

mysqlpdophpdatabasemysqlpdoDB Helper

### Embed Badge

![Health badge](/badges/restu-dbhelper/health.svg)

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

###  Alternatives

[lincanbin/php-pdo-mysql-class

A PHP MySQL PDO class similar to the Python MySQLdb, which supports iterator and parameter binding when using 'WHERE IN' statement.

2386.4k](/packages/lincanbin-php-pdo-mysql-class)[sorskod/db

PDO wrapper. Extends PDO and PDOStatement with useful methods.

788.1k2](/packages/sorskod-db)

PHPackages © 2026

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