PHPackages                             kingsoft/db - 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. kingsoft/db

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

kingsoft/db
===========

Efficient PDO Database connection wrapper. Reads settings from settings.ini/SETTINGS global constaant

2.9.3(1y ago)0306↓100%[6 issues](https://github.com/theking2/kingsoft-db/issues)2MITPHPPHP &gt;=8.0

Since Mar 31Pushed 1y ago1 watchersCompare

[ Source](https://github.com/theking2/kingsoft-db)[ Packagist](https://packagist.org/packages/kingsoft/db)[ RSS](/packages/kingsoft-db/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (2)Versions (22)Used By (2)

Database wrapper
================

[](#database-wrapper)

Singleton that uses `POD` and connects with the following options

- FETCH\_BOUND
- ERRMODE\_EXCEPTION
- SET NAMES utf8

Interface
---------

[](#interface)

- getConnection static returns the single instance PDO object
- throw DatabaseException

Configure
---------

[](#configure)

Use kingsoft/Utils to include a settings file

```
require $_SERVER['DOCUMENT_ROOT'] . '/vendor/kingsoft/utils/settings.inc.php';
```

The settings file should include this

```
[db]
hostname=hostname
database=database
username=username
password=password
```

Documenter
==========

[](#documenter)

A simple database documenter generaring the code to create tables, view, procedure and functions. Make sure the DB user has the proper rights to create these otherwise the result will be empty

Sample
------

[](#sample)

```
$dsn        = "mysql:host=" . SETTINGS['db']['hostname'] . ";dbname=" . SETTINGS['db']['database'];
$connection = new PDO(
    $dsn,
    SETTINGS['db']['username'],
    SETTINGS['db']['password'] );
$documentor = ( new \Documentor( $connection, SETTINGS['db']['database'] ) )
    ->do_tables()
    ->do_procedures()
    ->do_functions()
;
```

###  Health Score

35

—

LowBetter than 79% of packages

Maintenance47

Moderate activity, may be stable

Popularity13

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 82.9% 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 ~37 days

Recently: every ~3 days

Total

20

Last Release

428d ago

Major Versions

1.1.2 → 2.02023-07-05

### Community

Maintainers

![](https://www.gravatar.com/avatar/14e94b3b6471915120d2c866622251509c7573ae993f65e6f622c9047bff5c62?d=identicon)[kingsoft](/maintainers/kingsoft)

---

Top Contributors

[![theking2](https://avatars.githubusercontent.com/u/1612152?v=4)](https://github.com/theking2 "theking2 (34 commits)")[![kingma-sbw](https://avatars.githubusercontent.com/u/50140049?v=4)](https://github.com/kingma-sbw "kingma-sbw (7 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/kingsoft-db/health.svg)

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

###  Alternatives

[doctrine/orm

Object-Relational-Mapper for PHP

10.2k285.3M6.2k](/packages/doctrine-orm)[jdorn/sql-formatter

a PHP SQL highlighting library

3.9k115.1M102](/packages/jdorn-sql-formatter)[illuminate/database

The Illuminate Database package.

2.8k52.4M9.3k](/packages/illuminate-database)[mongodb/mongodb

MongoDB driver library

1.6k64.0M543](/packages/mongodb-mongodb)[ramsey/uuid-doctrine

Use ramsey/uuid as a Doctrine field type.

90340.3M209](/packages/ramsey-uuid-doctrine)[reliese/laravel

Reliese Components for Laravel Framework code generation.

1.7k3.4M16](/packages/reliese-laravel)

PHPackages © 2026

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