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 3w ago

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 31% 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

1997d ago

### Community

Maintainers

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

[jdorn/sql-formatter

a PHP SQL highlighting library

3.9k117.2M118](/packages/jdorn-sql-formatter)[propel/propel1

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

8351.6M87](/packages/propel-propel1)[jfelder/oracledb

Oracle DB driver for Laravel

11518.4k](/packages/jfelder-oracledb)

PHPackages © 2026

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