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

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

simpledatabase/simple-database
==============================

Simple Database API for PHP and SQL

016PHP

Since Mar 22Pushed 5y ago1 watchersCompare

[ Source](https://github.com/CooleKikker2/simpleDatabaseComposer)[ Packagist](https://packagist.org/packages/simpledatabase/simple-database)[ RSS](/packages/simpledatabase-simple-database/feed)WikiDiscussions master Synced 1w ago

READMEChangelogDependenciesVersions (1)Used By (0)

Simple database
===============

[](#simple-database)

Introduction
------------

[](#introduction)

> Simple Database is a very simple PHP API for using an SQL-Database with only a few lines of code. Use a full working SQL database with only a few lines of code.

Code Samples
------------

[](#code-samples)

> Full Documentation can be found here: [https://docs.google.com/document/d/1eufGXHW\_\_C4uOW9Lr9XoAAzOX8vFrd5qNAytYAM4VgQ/edit?usp=sharing](https://docs.google.com/document/d/1eufGXHW__C4uOW9Lr9XoAAzOX8vFrd5qNAytYAM4VgQ/edit?usp=sharing)

> **Connect to database**
>
> You can simply connect to your database using the following 2 lines of code.

```
$database = new Database("Your Servername", "Your Database User", "YourUserPassword", "YourDatabaseName");
$database->connect();
```

> After connection the database is available in the variable $database.
>
> **Insert into database**
>
> You can also easily insert data into a database using 2 arrays. One array is for the row names, the other for the rows value

```
$row = ['name', 'description', 'price'];
$value = ['Soap', 'A nice soap', 5.95];
$if($database->insertRow('products', $row, $value)){
    echo "Succesfully added product to products. The insert id is: " . $database->getInsertId();
}
```

> After inserting columns into the database as above, the last inserted id is available in $database-&gt;getInsertId();
>
> **Read from database**
>
> To read data from the database you need to use the $database-&gt;readAll(table) function.

```
$data = $database->readAll("products");
while($row = $data->fetch_assoc()){
    echo $row['name'];
}
```

> In the example above we get all data from the database and fetch the data to the variable $row. After that we can return the row\['name'\] from the database.

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

[](#installation)

> To install this API you can simply download the files on this github and put it into your root directory. Enable the API by adding the following line of code at the top of your PHP file

```
require_once("config/database/database.php");
```

###  Health Score

17

—

LowBetter than 6% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity30

Early-stage or recently created project

 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/1fe461845d31f2d0074a78932099afd2e54af04b1b61026efb32d91424e11624?d=identicon)[CooleKikker2](/maintainers/CooleKikker2)

---

Top Contributors

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

### Embed Badge

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

```
[![Health](https://phpackages.com/badges/simpledatabase-simple-database/health.svg)](https://phpackages.com/packages/simpledatabase-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.4k](/packages/illuminate-database)[mongodb/mongodb

MongoDB driver library

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

Use ramsey/uuid as a Doctrine field type.

90340.3M211](/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)
