PHPackages                             milantex/daw - 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. milantex/daw

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

milantex/daw
============

Database Access Wrapper for Milantex's projects.

1.0.5(9y ago)01152AGPL-3.0PHPPHP &gt;=7.0.0

Since Jul 10Pushed 9y agoCompare

[ Source](https://github.com/Milantex/milantex-daw)[ Packagist](https://packagist.org/packages/milantex/daw)[ RSS](/packages/milantex-daw/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependencies (1)Versions (6)Used By (2)

[![Build Status](https://camo.githubusercontent.com/c46c8f0e9cdeb3055a2863dcb27fe8c154ec9f9ab61d5e63fb4eb4d84b7541c4/68747470733a2f2f7472617669732d63692e6f72672f4d696c616e7465782f6d696c616e7465782d6461772e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/Milantex/milantex-daw)[![codecov](https://camo.githubusercontent.com/e53472b5ef0d4f0e9b0907dfadd4906f6483f2d1ac693c3053b6c55805df233a/68747470733a2f2f636f6465636f762e696f2f67682f4d696c616e7465782f6d696c616e7465782d6461772f6272616e63682f6d61737465722f67726170682f62616467652e737667)](https://codecov.io/gh/Milantex/milantex-daw)[![Code Climate](https://camo.githubusercontent.com/3b6b8788be6119e6e9f72d4ec4143270bd85e18ae7b5a5767609bb851eb085a9/68747470733a2f2f636f6465636c696d6174652e636f6d2f6769746875622f4d696c616e7465782f6d696c616e7465782d6461772f6261646765732f6770612e737667)](https://codeclimate.com/github/Milantex/milantex-daw)[![Latest Stable Version](https://camo.githubusercontent.com/1f8594e2c9c366e883cfd39b9e5c6a8e5e3b7451e138fe4e0f18898171cd8c8e/68747470733a2f2f706f7365722e707567782e6f72672f6d696c616e7465782f6461772f762f737461626c65)](https://packagist.org/packages/milantex/daw)[![Total Downloads](https://camo.githubusercontent.com/d582ef8fcf9ba8f13ec93e7b258774906fcafca1488d0a5c2641173b593662ff/68747470733a2f2f706f7365722e707567782e6f72672f6d696c616e7465782f6461772f646f776e6c6f616473)](https://packagist.org/packages/milantex/daw)[![License](https://camo.githubusercontent.com/e076d2305f11dea8d626870a5edc99bd5914a0f1e2d9fee93f483fd58fa0fdfd/68747470733a2f2f706f7365722e707567782e6f72672f6d696c616e7465782f6461772f6c6963656e7365)](https://packagist.org/packages/milantex/daw)[![SensioLabsInsight](https://camo.githubusercontent.com/15b6359d5d67ab151e21ac57bfaaa8b1355050c1ff2cab8c8a218872c51c4247/68747470733a2f2f696e73696768742e73656e73696f6c6162732e636f6d2f70726f6a656374732f33393930373938372d366237662d343265652d396561392d6165626236306563633765362f6d696e692e706e67)](https://insight.sensiolabs.com/projects/39907987-6b7f-42ee-9ea9-aebb60ecc7e6)

What is Milantex-DAW?
=====================

[](#what-is-milantex-daw)

This package provides a mechanism to easily connect and use a MySQL/MariaDB database. Check the text below for information about how to install it and to see examples of how to use it.

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

[](#installation)

#### Using composer in the command line

[](#using-composer-in-the-command-line)

You can use composer to install the package using the following command from within your project's source directory:

`composer require milantex/daw`

Make sure to update your autoloader if needed:

`composer dump-autoload -o`

#### Requiring the package as a dependency in composer.json

[](#requiring-the-package-as-a-dependency-in-composerjson)

Add the following code to your composer.json. Here is an example of a composer.json file with the milantex/daw package required:

```
{
    "name": "your-name/your-project",
    "description": "Your project's description",
    "type": "project",
    "license": "MIT",
    "authors": [
        {
            "name": "Your Name",
            "email": "your@mail.tld"
        }
    ],
    "require": {
        "milantex/daw": "*"
    }
}
```

Make sure to run the composer command to install dependencies:

`composer install`

Using it in your project
------------------------

[](#using-it-in-your-project)

To start using the DAW, first require the composer's autoload script:

```
require_once 'vendor/autoload.php';
```

After that, you can create an instance of Milantex\\DAW\\DataBase:

```
use Milantex\DAW\DataBase;

# Open a connection using the DAW
$daw = new DataBase('localhost', 'bayou', 'root', '');
```

Here is an example showing how you can select multiple records from the database and print it out:

```
# Write an SQL query (no parameters)
$query1 = 'SELECT * FROM `post` WHERE `visible` = 1;';

# Execute the query and retrieve all result set rows
$visiblePosts = $daw->selectMany($query1);

# Print out the dump of the result
echo '' . print_r($visiblePosts, true) . '';
```

**Output:**

```

  Array
  (
      [0] => stdClass Object
          (
              [post_id] => 1
              [created_at] => 2015-02-12 20:44:04
              [user_id] => 1
              [title] => Limitless Bayou begins
              [link] => limitsless-bayou-begins
              [content] => This is a sample post in a database.
              [visible] => 1
          )
  )

```

Here is an example showing how you can select a single record from the database with an SQL query and named parameter placeholders:

```
# Write an SQL query (with one parameter for the username)
$query2 = 'SELECT * FROM `user` WHERE `username` = :username AND `active` = 1;';

# Prepare the parameter associative array
$params2 = [ ':username' => 'milantex' ];

# Execute the query and retrieve a single result set
$user = $daw->selectOne($query2, $params2);

# Print out the dump of the result
echo '' . print_r($user, true) . '';
```

**Output:**

```

  stdClass Object
  (
      [user_id] => 1
      [created_At] => 2015-02-12 20:41:12
      [username] => milantex
      [password] => SOME_HASH_VALUE
      [active] => 1
  )

```

Here is an example showing how you can delete records from the database using unnamed parameter placeholders (ordered):

```
# Write an SQL query (with an unnamed parameter placeholder)
$query3 = 'DELETE FROM `post` WHERE `post_id` = ?;';

# Prepare the ordered parameter array
$params3 = [ 130 ];

# Execute the query and retrieve a single result set
$result3 = $daw->execute($query3, $params3);

# Check the result
if (!$result3) {
	# Print out the dump of error information if the result is bad
	echo '' . print_r($daw->getLastExecutionError(), true) . '';
} else {
	# Print out how many records were affected
	$affectedRows = $daw->getLastExecutionAffectedRownCount();
	echo 'Deleted record count: ' . $affectedRows . '';
}
```

**Output:**

```
Deleted record count: 0
```

Here is an example showing how you can add a record to a table, again using named parameter placeholders:

```
# Write an SQL query (with unnamed parameter placeholders)
$query4 = 'INSERT INTO `post` (`user_id`, `title`, `link`, `content`) '.
		  'VALUES (:user_id, :title, :link, :content);';

# Prepare the parameter associative array
$params4 = [
	':user_id' => 1,
	':title'   => 'A test post',
	':link'    => 'a-test-post',
	':content' => 'This is the content of the new test post.'
];

# Execute the query and retrieve a single result set
$result4 = $daw->execute($query4, $params4);

# Check the result
if (!$result4) {
	# Print out the dump of error information if the result is bad
	echo '' . print_r($daw->getLastExecutionError(), true) . '';
} else {
	# Get the ID of the new post
	$postId = $daw->getLastInsertId();
	echo 'The ID of the new post is: ' . $postId . '';
}
```

**Output:**

```
The ID of the new post is: 6
```

###  Health Score

28

—

LowBetter than 52% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity62

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

Total

5

Last Release

3562d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1736794?v=4)[Milan Tair](/maintainers/Milantex)[@Milantex](https://github.com/Milantex)

---

Top Contributors

[![Milantex](https://avatars.githubusercontent.com/u/1736794?v=4)](https://github.com/Milantex "Milantex (29 commits)")

---

Tags

phpdatabasemysqlmariadbsqlpdointerfacewrapper

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/milantex-daw/health.svg)

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

###  Alternatives

[doctrine/dbal

Powerful PHP database abstraction layer (DBAL) with many features for database schema introspection and management.

9.7k595.8M6.5k](/packages/doctrine-dbal)[ifsnop/mysqldump-php

PHP version of mysqldump cli that comes with MySQL

1.3k5.8M75](/packages/ifsnop-mysqldump-php)[clouddueling/mysqldump-php

PHP version of mysqldump cli that comes with MySQL

1.3k23.1k](/packages/clouddueling-mysqldump-php)[druidfi/mysqldump-php

PHP version of mysqldump cli that comes with MySQL

35571.9k6](/packages/druidfi-mysqldump-php)[ramadan/easy-model

A Laravel package for enjoyably managing database queries.

111.6k](/packages/ramadan-easy-model)

PHPackages © 2026

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