Download the PHP package yaknet/mock-engine without Composer
On this page you can find all versions of the php package yaknet/mock-engine. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download yaknet/mock-engine
More information about yaknet/mock-engine
Files in yaknet/mock-engine
Package mock-engine
Short Description In-memory SQL-like query builder and execution engine for PHP arrays
License MIT
Informations about the package mock-engine
MockEngine
MockEngine is a lightweight, pure PHP (PHP 8.1+) in-memory query engine that lets you filter, sort, join, group, and aggregate raw arrays or object lists using an elegant, Laravel/Symfony-style fluent Query Builder—completely without any database overhead!
It is perfect for unit testing, in-memory caching systems, sorting baskets in e-commerce, or managing nested datasets in microservices.
Features
- ✨ Fluent Query Builder: Build queries using
where(),orWhere(),select(),orderBy(),limit(),groupBy(),join(), andleftJoin(). - 🎯 Point Notation (Nested Access): Query nested arrays or objects instantly, e.g.,
where('profile.address.city', '=', 'Istanbul'). - ⚙️ Advanced Operators: Support for
=,!=,>,<,>=,<=,LIKE,NOT LIKE,IN,NOT IN,BETWEEN, andNOT BETWEEN. - 🔗 Relation Joins: Easily perform
INNER JOINandLEFT JOINoperations across different arrays or object collections. - 🗃️ Group By & Collections: Group results automatically, and utilize the built-in
Collectionwrapper for powerful aggregations (sum,avg,min,max,pluck). - 🚀 Zero Dependencies: Written entirely in pure, highly-optimized PHP.
Installation
Install the package via Composer:
Quick Start
1. Basic Filtering
2. Complex & Nested Logical Groups (AND / OR)
You can group logical operations together by passing a Closure to where or orWhere:
3. Joining Two Collections (INNER / LEFT JOIN)
4. Grouping & Collection Aggregations
If you use groupBy(), the results will be grouped into a nested Collection of Collections:
Running Tests
All features are fully verified with a comprehensive unit test suite:
License
This project is licensed under the MIT License. See LICENSE.md for details.