PHPackages                             mojahed/php-multiquery - 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. mojahed/php-multiquery

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

mojahed/php-multiquery
======================

Parallel MySQL query execution for raw PHP projects - Run multiple MySQL queries in parallel for efficient execution.

1.0.0(2mo ago)00MITPHPPHP ^7.4|^8.0

Since May 17Pushed 2mo agoCompare

[ Source](https://github.com/md-mojahed/php-multiquery)[ Packagist](https://packagist.org/packages/mojahed/php-multiquery)[ RSS](/packages/mojahed-php-multiquery/feed)WikiDiscussions master Synced 3w ago

READMEChangelogDependenciesVersions (2)Used By (0)

mojahed/php-multiquery
======================

[](#mojahedphp-multiquery)

Parallel MySQL query execution for raw PHP projects using the `msquery`.

No framework required. PHP 7.4+.

Requirements
------------

[](#requirements)

- PHP 7.4+
- `msquery` installed on server

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

[](#installation)

```
composer require mojahed/php-multiquery
```

Binary Setup
------------

[](#binary-setup)

```
cp msquery-linux-amd64 /usr/local/bin/msquery
chmod +x /usr/local/bin/msquery
```

---

Usage
-----

[](#usage)

```
use Mojahed\Raw\MultiQuery;

$results = MultiQuery::setConfig([
    'binary'   => '/usr/local/bin/msquery',
    'host'     => '127.0.0.1',
    'port'     => '3306',
    'user'     => 'root',
    'pass'     => 'secret',
    'database' => 'my_database',
    'timeout'  => 30,
    'throw'    => true,
])->run([
    'users'   => "SELECT COUNT(*) as total FROM users",
    'orders'  => "SELECT COUNT(*) as total FROM orders",
    'revenue' => "SELECT SUM(amount) as total FROM payments",
]);

$results['users']   // [['total' => 150]]
$results['orders']  // [['total' => 320]]
$results['revenue'] // [['total' => 250000]]
```

Reuse Instance
--------------

[](#reuse-instance)

```
$mq = MultiQuery::setConfig([...]);

$stats   = $mq->run([...]);
$reports = $mq->run([...]);
```

Error Handling
--------------

[](#error-handling)

```
use Mojahed\Raw\Exceptions\MultiQueryException;

try {
    $results = MultiQuery::setConfig([...])->run([
        'users'  => "SELECT COUNT(*) as total FROM users",
        'broken' => "SELECT * FROM non_existing_table",
    ]);
} catch (MultiQueryException $e) {
    $e->getFailedIndex();  // which query failed
    $e->getErrorString();  // MySQL error message
    $e->getResults();      // all raw results
}
```

Config Options
--------------

[](#config-options)

OptionDefaultDescriptionbinary/usr/local/bin/msqueryPath to binaryhost127.0.0.1MySQL hostport3306MySQL portuser-MySQL usernamepass-MySQL passworddatabase-Database nametimeout30MySQL connection timeout (seconds)throwtrueThrow on failure

###  Health Score

33

—

LowBetter than 72% of packages

Maintenance86

Actively maintained with recent releases

Popularity0

Limited adoption so far

Community2

Small or concentrated contributor base

Maturity38

Early-stage or recently created project

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

68d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/92214734?v=4)[Md Mojahedul Islam](/maintainers/md-mojahed)[@md-mojahed](https://github.com/md-mojahed)

---

Tags

phpconcurrentdatabaseperformancemysqlparallelmultiquery

### Embed Badge

![Health badge](/badges/mojahed-php-multiquery/health.svg)

```
[![Health](https://phpackages.com/badges/mojahed-php-multiquery/health.svg)](https://phpackages.com/packages/mojahed-php-multiquery)
```

###  Alternatives

[clouddueling/mysqldump-php

PHP version of mysqldump cli that comes with MySQL

1.3k23.2k](/packages/clouddueling-mysqldump-php)[codezero/laravel-unique-translation

Check if a translated value in a JSON column is unique in the database.

1881.0M8](/packages/codezero-laravel-unique-translation)[awssat/laravel-sync-migration

Laravel tool helps to sync migrations without refreshing the database

10823.4k](/packages/awssat-laravel-sync-migration)

PHPackages © 2026

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