PHPackages                             ice-cream/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. ice-cream/database

ActiveLibrary

ice-cream/database
==================

Database connection handler for IceCream Framework

1.4.2(8y ago)221MITPHPPHP &gt;=7.2.0

Since Jan 12Pushed 8y agoCompare

[ Source](https://github.com/AdamKyle/ice-cream-database)[ Packagist](https://packagist.org/packages/ice-cream/database)[ RSS](/packages/ice-cream-database/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (8)Dependencies (5)Versions (9)Used By (0)

Ice Cream Database
==================

[](#ice-cream-database)

[![Build Status](https://camo.githubusercontent.com/049e4facaef930b8abd1752889721071135fa8cf771a57a13c67ee9f4770b5b9/68747470733a2f2f7472617669732d63692e6f72672f4164616d4b796c652f6963652d637265616d2d64617461626173652e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/AdamKyle/ice-cream-database)[![Packagist](https://camo.githubusercontent.com/bcb60a5c3cedef142692432bcc0f6ffbaf4f02fca5bec08016e805bf237d947b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6963652d637265616d2f64617461626173652e737667)](https://packagist.org/packages/ice-cream/database)![Maintenance](https://camo.githubusercontent.com/bc62a4386260fb7a4c9f5e3977f2f2bf876ad0374f462e723cedd156953a0da4/68747470733a2f2f696d672e736869656c64732e696f2f6d61696e74656e616e63652f7965732f323031382e737667)![Made With Love](https://camo.githubusercontent.com/8e692b7ce6dc41cb29efb7aa471b6e72a0a009ff99bf93ca83023a3da4e177b8/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4d616465253230576974682d4c6f76652d677265656e2e737667)

A DBAL at the most simplest of terms. Its a thin wrapper around PDO, while returning a connected PDO object.

We can connect to multiple database instances of either PGSQL or MYSQL (see below) and create open connections to each.

- Requires PHP 7.2.x
- Is Standalone

Install
-------

[](#install)

`composer require ice-cream/database`

Purpose?
--------

[](#purpose)

I wanted to understand PDO, and I still have a lot to learn about it. I could have used and created a thin wrapper around Doctrines DBAL, much like I did with [Ice Cream Router](https://github.com/AdamKyle/ice-cream-router) in the sense that I did a thin wrapper around Symfony's router.

But I thought I could build something super simple, super easy to get started with and something that allowed me to understand exactly how PHP connects to a database.

While this isn't as fully flushed out as a regular DBAL, it is a good step in the process. You open a connection, get a db object back, do your work and you move on with your life.

There is room for growth here and room for improvement and your feedback and help will help to shape Ice Cream components into a framework.

Documentation
-------------

[](#documentation)

You can see the full documentation for the project [here](https://github.com/AdamKyle/ice-cream-database/blob/master/docs/ApiIndex.md)

Configuration
-------------

[](#configuration)

Create a new connection instance:

```
use IceCreamDatabase\Connect;

// Similar to that of Laravel if you are familiar.
$connections = [
  'mysql' => [
    'host' => '127.0.0.1',
    'port' => 3306,
    'database' => '',
    'username' => 'root',
    'password' => 'root',
    'charset' => 'utf8',
  ],
  'pgsql' => [
    'host' => '127.0.0.1',
    'port' => 5432,
    'dbname' => 'scotchbox',
    'username' => 'root',
    'password' => 'root',
    'charset' => 'utf8',
  ],
  'sqlite' => [
    'temp_file' => ':memory'
  ]
]

// At this time I have made the choice to only support mysql and pgsql as well as sqlite connections.
// More can be added in the future, simplicity was the game here.

$con = new Connect($connections);
```

This will throw a PDO exception if we cannot connect to the database. This constructor will also connect to all databases registered in the connection array.

> ## ATTN!!
>
> [](#attn)
>
> At this time the options you see specified in the array are the only ones we accept. I wanted to get this component out the door in a couple of days and decided to keep it as simple as possible for the first iteration.

So now that we are connected what can we do?

```
$con->db()->exec( ... );

// Should you have multiple databases configured you can do:

$con->db('mysql')->exec( ... );
$con->db('pgsql')->exec( ... );
$con->db('sqlite')->exec( ... );
```

> ## ATTN!!
>
> [](#attn-1)
>
> Notice in the configuration how we have the key as `mysql` or `pgsql` as well as `sqlite`?
>
> This is important because these correlate to the supported drivers that create the connection strings to connect to the database in question.
>
> These names are also whats stored in the associated connections manager that manages all connections.

```
// Get the current connection name:
$con->manager()->getCurrentConnectionName(); // mysql, sqlite or pgsql
```

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity63

Established project with proven stability

 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

Every ~61 days

Recently: every ~106 days

Total

8

Last Release

2981d ago

PHP version history (2 changes)1.0PHP &gt;=7.0.0

1.4.2PHP &gt;=7.2.0

### Community

Maintainers

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

---

Top Contributors

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

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/ice-cream-database/health.svg)

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

PHPackages © 2026

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