PHPackages                             amadiify/querydb - 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. amadiify/querydb

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

amadiify/querydb
================

This package provides more flexibility working with mysql, sqlite and pgsql database systems in PHP out of the box.

0.1(6y ago)06MITPHPPHP ^7.1

Since Dec 1Pushed 6y ago1 watchersCompare

[ Source](https://github.com/amadiify/phporm)[ Packagist](https://packagist.org/packages/amadiify/querydb)[ RSS](/packages/amadiify-querydb/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (1)DependenciesVersions (2)Used By (0)

Database ORM Handler for PHP
----------------------------

[](#database-orm-handler-for-php)

- This package provides more flexibility working with mysql, sqlite and pgsql database systems in PHP out of the box. It's an extension of Moorexa Query Builder. You should check out **Moorexa** for your next amazing web app.

### How to use

[](#how-to-use)

- Configure your database connection settings in **Amadiify/Connection.php**You can create multiple connection setting and switch connection during run time. But first, a default connection must be avaliable for fallbacks.

Here is how the connection file looks like.

```
    'default' => [
        'dsn' 		=> '{driver}:host={host};dbname={dbname};charset={charset}',
		'driver'    => 'mysql', // mysql, pgsql, sqlite
		'host' 	    => '',
		'user'      => '',
		'password'  => '',
		'dbname'    => '',
		'charset'   => 'UTF8',
		'port'      => '',
		'handler'   => 'pdo', // pdo or mysqli
		'attributes'=> true,
		'production'=> [
			'driver'  =>   'mysql',
			'host'    =>   '',
			'user'    =>   '',
			'password'  =>   '',
			'dbname'    =>   '',
		],
		'options'   => [ PDO::ATTR_PERSISTENT => true ]
     ]
     // you can add more
```

### Security

[](#security)

- Oh yeah, it's safe. All queries are prepared and filtered even down to raw sql statements.

Once this is done, you can **Use** this connection. see example:

```
use Amadiify\Client;
```

Get Request
-----------

[](#get-request)

- perform a basic get request (select query)

```
    // generic option
    Client::table('user')->get();
    // or
    Client::user()->get();
    // or
    \user::get(); // some other configuration must be made for this to work.
```

More Advance Get request
------------------------

[](#more-advance-get-request)

- This goes beyond the basics.

```
    // using generic
    Client::table('user')->get('userid=?', 1);
    // or
    Client::table('user')->get('userid=?')->bind(1);
    // or
    Client::table('user')->get('username,password')->where('userid=?')->bind(1);
    // we can even perform two actions at the same time
    Client::table('user')->get('userid=?')->bind(1)->update(['username' => 'frank']);
    // get random
    Client::table('user')->get()->rand();
    // using limit
    Client::table('user')->get()->limit(0,20);
    // using order
    Client::table('user')->get()->orderby('username', 'asc')->limit(0,20);
    // and much more.
    // see the cheat sheet for more possibilities.
```

Insert Request
--------------

[](#insert-request)

- You can insert in multiples. System protects you from double records. Keeps everything unqiuely stored.
- You can apply loops and chain other actions in one line.

```
    // lets insert something simple
    $table = Client::table('user');
    // simple first
    $table->insert(['username' => 'chris']);
    // multiple
    $table->insert(['username' => 'mack'], ['username' => 'frank']); // and much more
    // if you drop the line you need to instruct execution
    $table->insert(
        ['username' => 'mack'],
        ['username' => 'sam']
    )->go();
    // or
    $table->insert('username,password')->bind('mack', '1234');
    // or
    $table->insert('username,password', 'mack', '1234');
    // or run a get after
    $table->insert('username,password')->bind('mack', '1234')->get(); // returns records.
    $data = [

        [
            'username' => 'Moorexa',
            'password' => 'hash-password'
        ],

        [
            'username' => 'Wekiwork',
            'password' => 'hash-password'
        ]

    ];
    array_map(function($data){
        Client::table('user')->insert($data);
    }, $data);
    // insert json data
    $table->insert('{"username":"mike2", "password":"hash-password2"}');
    // or insert an object
    $object = (object) $data;
    $table->insert($object);
    // and much more..
```

Update Request
--------------

[](#update-request)

- You can run update easily, and chain other actions along side that request

```
    // get table
    $table = Client::table('user');
    // update with json
    $table->update('{"username":"chris", "id":3}', 'userid=?', 3);
    // or
    $table->update('{"username":"chris", "id":3}')->where('userid=?', 3);
    // or
    $table->update('{"username":"chris", "id":3}')->where('userid=?', 3);
    // or
    $table->update(['username' => 'chris'], 'userid = ?', 3);
    // or
    $table->update(['username' => 'moorexa'])->where('userid = ?')->bind(3);
    // or
    $get = $table->get('username = ?')->bind('chris');
    // then update that row
    $get->update(['telephone' => '080000000000']);
    // and much more
```

Delete Request
--------------

[](#delete-request)

- You can run delete queries easily and also chain other actions along side that request

```
    // get table
    $table = Client::table('user');
    // update with json
    $table->delete('userid = ?')->bind(30);
    // or
    $table->delete(['userid' => 3]);
    // or
    $get = $table->get('userid = ?', 2);
    // then delete that row
    $get->pop();
    // and much more
```

Raw sql
-------

[](#raw-sql)

- Raw sql statements are prepared also, lets see an example

```
    Client::sql('select * from users where username = ?', 'chris');
    // or
    Client::sql('select * from users where username = :name')->bind('chris');
    // or
    Client::sql('select * from users where username = "chris"');
    // interpreted as
    // select * from users where username = :username
    // or
    $table = new Client();
    $table->sql('Your query here.');
```

Switch database connection
--------------------------

[](#switch-database-connection)

- You can switch to a different connection during run time. It's easy

```
    $default = Client::serve();
    $switch1 = Client::apply('database1');
    // and other queries can be chained here
```

This is just an evaluation copy, You can do much more with this in Moorexa. You can share and contribute, thank you.

###  Health Score

20

—

LowBetter than 13% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity42

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

Unknown

Total

1

Last Release

2405d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/62617935?v=4)[WekiWork Creative Lab](/maintainers/wekiwork)[@wekiwork](https://github.com/wekiwork)

---

Top Contributors

[![amadiify](https://avatars.githubusercontent.com/u/49183066?v=4)](https://github.com/amadiify "amadiify (17 commits)")

### Embed Badge

![Health badge](/badges/amadiify-querydb/health.svg)

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

###  Alternatives

[jdorn/sql-formatter

a PHP SQL highlighting library

3.9k117.2M118](/packages/jdorn-sql-formatter)[propel/propel1

Propel is an open-source Object-Relational Mapping (ORM) for PHP5.

8351.6M87](/packages/propel-propel1)[jfelder/oracledb

Oracle DB driver for Laravel

11518.4k](/packages/jfelder-oracledb)

PHPackages © 2026

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