PHPackages                             ajbassett539/simple-database - 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. ajbassett539/simple-database

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

ajbassett539/simple-database
============================

Simple mysqli database wrapper to retrieve stdClass objects.

1.0(5y ago)017PHP

Since Jan 12Pushed 5y ago1 watchersCompare

[ Source](https://github.com/ajbassett539/simple-database)[ Packagist](https://packagist.org/packages/ajbassett539/simple-database)[ RSS](/packages/ajbassett539-simple-database/feed)WikiDiscussions main Synced today

READMEChangelog (1)DependenciesVersions (2)Used By (0)

simple-database
===============

[](#simple-database)

Simple mysqli Database Wrapper to Retrieve stdClass Objects.

Installation
------------

[](#installation)

`composer require ajbassett539/simple-database`

Instantiation
-------------

[](#instantiation)

`include 'vendor/autoload.php';`

`$db = new \Database\DB();`

Credentials
-----------

[](#credentials)

```
## .htaccess
SetEnv DATABASE_HOST localhost
SetEnv DATABASE_USER usernaem
SetEnv DATABASE_PASS passwerd
SetEnv DATABASE_NAME fancy_db
SetEnv LOG_SQL_QUERIES 1

```

Methods
-------

[](#methods)

### query

[](#query)

`public function query($sql = "", $multirow = false, $raw = false)`

Takes an SQL string and attempts to execute. You are responsible for sanitization and syntax.

If you anticipate multiple rows, `$multirow = true`.

If you'd rather have the [mysqli result object](https://www.php.net/manual/en/class.mysqli-result.php), `$raw = true`.

Returns stdClass PHP object(s) for the result or false.

### execute

[](#execute)

`public static function execute($sql = "", $multirow = false, $raw = false)`

Does the same exact thing, just called statically.

Creates a new connection for each call, so it's not advisable to use this in a loop.

### escape

[](#escape)

`public function escape($string)`

Returns the [escaped](https://www.php.net/manual/en/mysqli.real-escape-string.php) string.

### real\_escape

[](#real_escape)

`public static function real_escape($string)`

Does the same thing, just [called statically](https://www.php.net/manual/en/language.oop5.static.php).

### getLastError

[](#getlasterror)

`public function getLastError()`

Returns the last error as string.

### affected\_rows

[](#affected_rows)

`public function affected_rows()`

Returns the [affected rows](https://www.php.net/manual/en/mysqli.affected-rows.php) of the last query.

### insert\_id

[](#insert_id)

`public function insert_id()`

Return the [insert id](https://www.php.net/manual/en/mysqli.insert-id.php) of the last query.

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity53

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

Unknown

Total

1

Last Release

1942d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/a0fc324eeb0d426d99dccf23a157323e4ead8937a77734f4f9eba82ec1d8ec29?d=identicon)[ajbassett539](/maintainers/ajbassett539)

---

Top Contributors

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

### Embed Badge

![Health badge](/badges/ajbassett539-simple-database/health.svg)

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

###  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.0M542](/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)
