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)0312[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 1w 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

33

—

LowBetter than 72% of packages

Maintenance39

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity60

Established project with proven stability

 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

518d ago

Major Versions

1.1.2 → 2.02023-07-05

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/16472624?v=4)[kingsoft](/maintainers/kingsoft)[@kingsoft](https://github.com/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

[jdorn/sql-formatter

a PHP SQL highlighting library

3.8k117.8M121](/packages/jdorn-sql-formatter)[backup-manager/backup-manager

A framework agnostic database backup manager with user-definable procedures and support for S3, Dropbox, FTP, SFTP, and more with drivers for popular frameworks.

1.7k1.6M11](/packages/backup-manager-backup-manager)[propel/propel1

Propel is an open-source Object-Relational Mapping (ORM) for PHP5.

8351.6M87](/packages/propel-propel1)[insolita/yii2-migration-generator

Set of gii tools for generating files for migration by schema of table , phpdoc or table data

108508.0k5](/packages/insolita-yii2-migration-generator)[xpdo/xpdo

A PDO-based Object/Relational Bridge Library

7088.4k4](/packages/xpdo-xpdo)[voku/session2db

A PHP library acting as a wrapper for PHP's default session handling functions which stores data in a MySQL database, providing both better performance and better security and protection against session fixation and session hijacking.

3220.0k](/packages/voku-session2db)

PHPackages © 2026

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