Download the PHP package mojahed/multiquery without Composer
On this page you can find all versions of the php package mojahed/multiquery. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download mojahed/multiquery
More information about mojahed/multiquery
Files in mojahed/multiquery
Package multiquery
Short Description Parallel MySQL query execution for Laravel projects - Run multiple MySQL queries in parallel for efficient execution.
License MIT
Informations about the package multiquery
Mojahed MultiQuery — Laravel Package
Fire multiple MySQL queries in parallel using a binary. Dashboard stats that took 500ms now take 50ms.
Requirements
- PHP 8.1+
- Laravel 10, 11, or 12
msquerybinary installed on server
Installation
Auto-discovery registers everything. No manual setup needed.
Binary Setup
Install the msquery binary on your server:
Add to .env:
Publish Config (Optional)
Usage
Basic — Raw SQL
Eloquent Builder with mq()
All Supported Modes
Note:
count,sum,avg,min, andmaxmodes automatically rewrite the query to use the proper SQL aggregate function. You don't need to writeselectRaw('COUNT(*)')yourself — just pass the mode and column.
Aggregates with GROUP BY
When using groupBy, don't use aggregate modes like mq('count') — they rewrite the SELECT and won't give you grouped results. Instead, write the aggregate yourself and use mq('get'):
This applies to any query where you need grouped aggregates or custom aggregate expressions.
Eager Loading (with) Not Supported
Eloquent's with() eager loading does not work with mq(). Eager loading fires separate queries behind the scenes after the main query — since mq() extracts raw SQL and sends it to the Go binary, Laravel never gets a chance to run those follow-up queries.
Named Keys
Different DB Connection
Manual Model Mapping (for DB::table queries)
Manual Convert
Mixed — Raw SQL + Builder
Error Handling
Disable throw in config/multiquery.php: