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

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

alksily/database
================

Database is PDO wrapper

1.1(6y ago)06MITPHPPHP &gt;=7.0

Since Mar 4Pushed 6y ago1 watchersCompare

[ Source](https://github.com/alksily/database)[ Packagist](https://packagist.org/packages/alksily/database)[ Docs](https://github.com/alksily/database)[ RSS](/packages/alksily-database/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependenciesVersions (6)Used By (0)

Database Component
==================

[](#database-component)

It allows you connect the database to a project using a wrapper around the PDO.

#### Requirements

[](#requirements)

- PHP &gt;= 7.0

#### Installation

[](#installation)

Run the following command in the root directory of your web project:

> `composer require alksily/database`

#### Usage

[](#usage)

```
Alksily\Database\Db::initialize([
    [
        'dsn' => 'mysql:host=HOST;dbname=DB_NAME',
        'username' => 'DB_USER',
        'password' => 'DB_PASS',
        // additional can be passed options, server-role and pool name:
        // 'option'     => [
        //     PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES 'UTF8'",
        //     PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
        // ],
        // 'role'       => 'master', // or slave
        // 'pool_name'  => 'default', // pool list of connections
    ],
    // possible another connection config
    // for the implementation of master-slave
]);
```

Query execution

```
$stm = Alksily\Database\Db::query('SELECT * FROM `user` WHERE `age` > 23');

while ($a = $stm->fetch(PDO::FETCH_ASSOC)) {
    // some action
    var_dump($a);
}
```

#### Aliases

[](#aliases)

Select rows

```
$list = $db->select('SELECT * FROM `products` WHERE `price` >= 150');
```

Select first element of array from `select` method

```
$first = $db->selectOne('SELECT * FROM `products` WHERE `price` >= 150');
```

Affect row and return count of affected

```
$affected = $db->affect('INSERT INTO `products` SET `name` = "Socks with owls", `price` = 200');
```

#### Contributing

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

#### License

[](#license)

The Alksily Database is licensed under the MIT license. See [License File](LICENSE.md) for more information.

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity59

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

Every ~55 days

Total

5

Last Release

2409d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/5148853?v=4)[Aleksey Ilyin](/maintainers/alksily)[@alksily](https://github.com/alksily)

---

Top Contributors

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

---

Tags

phpdatabasepdo

### Embed Badge

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

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

###  Alternatives

[ifsnop/mysqldump-php

PHP version of mysqldump cli that comes with MySQL

1.3k5.5M69](/packages/ifsnop-mysqldump-php)[clouddueling/mysqldump-php

PHP version of mysqldump cli that comes with MySQL

1.3k22.9k](/packages/clouddueling-mysqldump-php)[popphp/pop-db

Pop Db Component for Pop PHP Framework

1814.6k11](/packages/popphp-pop-db)[riverside/php-orm

PHP ORM micro-library and query builder

111.2k](/packages/riverside-php-orm)

PHPackages © 2026

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