PHPackages                             alexdremov/daim - 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. alexdremov/daim

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

alexdremov/daim
===============

Lightweight and efficient MySQL PHP requests framework

v0.2.3(6y ago)06MITPHPCI failing

Since Jan 27Pushed 5y ago1 watchersCompare

[ Source](https://github.com/AlexRoar/DAIM)[ Packagist](https://packagist.org/packages/alexdremov/daim)[ Docs](https://github.com/AlexRoar/DAIM)[ RSS](/packages/alexdremov-daim/feed)WikiDiscussions master Synced 4d ago

READMEChangelog (4)Dependencies (1)Versions (6)Used By (0)

DAIM
====

[](#daim)

[![](https://camo.githubusercontent.com/8677d56f7adc580d37c9f6ac6c39bc0216b07a0025c807287a177a4d7c88c953/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7374617475732d626574612d726564)](https://camo.githubusercontent.com/8677d56f7adc580d37c9f6ac6c39bc0216b07a0025c807287a177a4d7c88c953/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7374617475732d626574612d726564)[![](https://camo.githubusercontent.com/456105dcdfb4983b4bd363a2d12f6829c211ab8b79e344444cff827cbdaec188/68747470733a2f2f696d672e736869656c64732e696f2f636972636c6563692f6275696c642f6769746875622f416c6578526f61722f4441494d2f6d6173746572)](https://camo.githubusercontent.com/456105dcdfb4983b4bd363a2d12f6829c211ab8b79e344444cff827cbdaec188/68747470733a2f2f696d672e736869656c64732e696f2f636972636c6563692f6275696c642f6769746875622f416c6578526f61722f4441494d2f6d6173746572)[![](https://camo.githubusercontent.com/d2bd73dd3b0f6c6fd99b9e4404df9ba81e9cf4d1478eb2381157573ef5fa1db6/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f7265706f2d73697a652f416c6578526f61722f4441494d)](https://camo.githubusercontent.com/d2bd73dd3b0f6c6fd99b9e4404df9ba81e9cf4d1478eb2381157573ef5fa1db6/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f7265706f2d73697a652f416c6578526f61722f4441494d)[![](https://camo.githubusercontent.com/e2592eddec2f6e5d22bb39cd31d1545881b10bebaf29fbcce144829221d15f4f/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6173742d636f6d6d69742f416c6578526f61722f4441494d)](https://camo.githubusercontent.com/e2592eddec2f6e5d22bb39cd31d1545881b10bebaf29fbcce144829221d15f4f/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6173742d636f6d6d69742f416c6578526f61722f4441494d)

The framework is designed to minimize usage of SQL code in interactions between MySQL server and PHP scripts; to bind PHP object alterations with DB alterations.

Why it is gorgeous?
-------------------

[](#why-it-is-gorgeous)

- Reactive models. You change PHP model — Database changes automatically.
- Generates PHP classes according to existing tables, helps your IDE with suggestions.
- Keeps connections efficient, as it uses only one active MySQL connection throughout all interactions.
- Keeps connections to multiple databases organized.
- Automatic prevention of SQL-injections.

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

[](#installation)

Just use [composer](https://getcomposer.org).

```
composer require alexdremov/daim
```

Usage
-----

[](#usage)

You can use it for keeping your Database connections organized and single. At first, you need to setup the framework:

```
use DAIM\Core\Connection;
use DAIM\Core\Credentials;

$cred = new Credentials();
$cred->setHost(host);
$cred->setUsername(username);
$cred->setDBname(DBname);
$cred->setPassword(password);
$cred->setPort(port);

Connection::setCredentials($cred);
Connection::initConnection();

Connection::getConnection(); # returns active MySQL connection (instance of mysqli class);

# To set up a second connection (maybe to the second database),
# you can create additional connection mode:

/**
 * Set up $cred2 as instance of Credentials class for the second connection
 * @var $cred2 Credentials;
 */

Connection::setCredentials($cred2, "secondConnectionName");
Connection::initConnection("secondConnectionName");
```

Now we are ready to go.

```
// Basic raw query.
Connection::query('SELECT * FROM `Persons` WHERE 1', "secondConnectionName");
```

Currently, I am working on Query Builder. The project's state is beta, but some features are already available:

SELECT:

```
use DAIM\Core\QueryBuilder;
use DAIM\Syntax\SQLEntities\Conditions;

$qb = new QueryBuilder();
$result = $qb->select('*')->from('Information')->request();

# Or more complicated usage:

$result = $qb->select(
    'Persons.LastName', 'Persons.PersonID', 'Information.Tel'
)->from(
    'Information', 'Persons'
)->where(
    (new Conditions())->field('Information.PersonID')->equal()->field('Persons.PersonID')
)->request();

# Generates SQL
# SELECT Persons.LastName, Persons.PersonID, Information.Tel FROM Information, Persons WHERE Information.PersonID = Persons.PersonID
# final ->request() returns instance of QueryResult class.
```

INSERT:

```
use DAIM\Core\QueryBuilder;

$qb = new QueryBuilder();

$qb->insertInto('tableName', array(
"field1"=>"value1",
"field2"=>"value2"
));
$response = $qb->request(); // Commit changes

// Or longer version:

$qb->insertInto('tableName')->columns('field1', 'field2', 'field3')->values('value1', 'value2', 'value3')->request();
$qb->insertInto('tableName')->values('value1', 'value2', 'value3')->request();
```

Subqueries are also available in INSERT builder.

Such limited library usage is due to the beta status of the project.

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity50

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 ~3 days

Total

5

Last Release

2285d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/146498430?v=4)[AlexRoar](/maintainers/AlexRoar)[@Alexroar](https://github.com/Alexroar)

---

Top Contributors

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

---

Tags

betadaimdbphpquerybuildersqlphpmysqlrequestsqueriesMySQL PHP

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/alexdremov-daim/health.svg)

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

###  Alternatives

[leantime/leantime

Open source project management system for non-project managers. Simple like Trello, powerful like Jira. Built with neurodiversity in mind.

9.4k2.8k](/packages/leantime-leantime)[clouddueling/mysqldump-php

PHP version of mysqldump cli that comes with MySQL

1.3k22.9k](/packages/clouddueling-mysqldump-php)[stefangabos/zebra_database

An advanced, compact and lightweight MySQL database wrapper library, built around PHP's MySQLi extension.

11812.0k](/packages/stefangabos-zebra-database)[eftec/pdoone

Minimaist procedural PDO wrapper library

1105.9k9](/packages/eftec-pdoone)[popphp/pop-db

Pop Db Component for Pop PHP Framework

1814.6k11](/packages/popphp-pop-db)[matthew-p/docker-server

Universal docker server, Nginx, PHP-FPM, MySql, Redis

112.8k](/packages/matthew-p-docker-server)

PHPackages © 2026

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