PHPackages                             processmaker/pmql - 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. processmaker/pmql

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

processmaker/pmql
=================

An Eloquent trait that provides the pmql scope to allow converting simple sql criteria clauses to Eloquent

1.13.3(2mo ago)1088.5k↓22.4%13[7 issues](https://github.com/ProcessMaker/pmql/issues)[4 PRs](https://github.com/ProcessMaker/pmql/pulls)PHPCI passing

Since Apr 23Pushed 1mo ago23 watchersCompare

[ Source](https://github.com/ProcessMaker/pmql)[ Packagist](https://packagist.org/packages/processmaker/pmql)[ RSS](/packages/processmaker-pmql/feed)WikiDiscussions develop Synced 2d ago

READMEChangelog (10)Dependencies (3)Versions (64)Used By (0)

pmql
====

[](#pmql)

ProcessMaker Query Language

Support for simple SQL-like expressions and converting to Laravel Eloquent. Exposes a Eloquent scope 'pmql' to pass in clauses.

Table of Contents
-----------------

[](#table-of-contents)

- [pmql](#pmql)
    - [Table of Contents](#table-of-contents)
    - [Simple Usage](#simple-usage)
    - [Operators](#operators)
        - [Comparison Operators](#comparison-operators)
        - [Logical Operators](#logical-operators)
    - [Case Sensitivity](#case-sensitivity)
    - [Casting](#casting)
    - [Dates](#dates)
    - [Syntax Examples](#syntax-examples)
        - [Sample Dataset](#sample-dataset)
        - [Basic Syntax](#basic-syntax)
            - [Query](#query)
            - [Result](#result)
        - [And](#and)
            - [Query](#query-1)
            - [Result](#result-1)
        - [Or](#or)
            - [Query](#query-2)
            - [Result](#result-2)
        - [IN](#in)
            - [Query](#query-3)
            - [Result](#result-3)
        - [NOT IN](#not-in)
            - [Query](#query-4)
            - [Result](#result-4)
        - [Grouping](#grouping)
            - [Query](#query-5)
            - [Result](#result-5)
        - [Numeric Comparison](#numeric-comparison)
            - [Query](#query-6)
            - [Result](#result-6)
        - [Casting To Number](#casting-to-number)
            - [Query](#query-7)
            - [Result](#result-7)
        - [Date Comparison](#date-comparison)
            - [Query](#query-8)
            - [Result](#result-8)
        - [Dynamic Date Comparison](#dynamic-date-comparison)
            - [Query](#query-9)
            - [Result](#result-9)
        - [Pattern Matching](#pattern-matching)
            - [Start of String](#start-of-string)
                - [Query](#query-10)
                - [Result](#result-10)
            - [Exact Pattern](#exact-pattern)
                - [Query](#query-11)
                - [Result](#result-11)
            - [End of String](#end-of-string)
                - [Query](#query-12)
                - [Result](#result-12)
            - [String Contains](#string-contains)
                - [Query](#query-13)
                - [Result](#result-13)
            - [Ignore Case](#ignore-case)
                - [Query](#query-14)
                - [Result](#result-14)
    - [Custom Callbacks](#custom-callbacks)

Simple Usage
------------

[](#simple-usage)

```
$results = Record::where('id', ' 8
```

#### Result

[](#result-6)

idfirst\_namelast\_namepositiondobexperiencestarter11EpiphannyPrinceguard1988-01-119false1TameraYoungforward1986-10-3011false---

### Casting To Number

[](#casting-to-number)

What if a field we want to compare mathematically is stored as a string instead of an integer? No problem. We can simply cast it as a number.

Let's say our dataset has changed to store the *experience* field as a string but we want to find all players with 2 years of experience or less.

#### Query

[](#query-7)

```
cast(experience as number) pmql('username = "FOOBAR" AND age < 25', function($expression) {
    // This example will ensure checking for lowercase usernames as thats how it stored in our database
    if($expression->field->field() == 'username') {
        // If you want to modify the query, you need to return an anonymous function that will add your additional criteria
        return function($query) use($expression) {
                $query->where(DB::raw('LOWER(username)', $expression->operator, strtolower($expression->value->value()));
        }
    }
    // Let default behavior win for non username fields
    return false;
})->get();
```

###  Health Score

57

—

FairBetter than 98% of packages

Maintenance74

Regular maintenance activity

Popularity41

Moderate usage in the ecosystem

Community25

Small or concentrated contributor base

Maturity74

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

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

Recently: every ~217 days

Total

27

Last Release

85d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/2ab66faa2bb09e27a5499a2aa35203a378d656d7df3b21582ace7f447cde8605?d=identicon)[processmaker](/maintainers/processmaker)

---

Top Contributors

[![ryancooley](https://avatars.githubusercontent.com/u/867714?v=4)](https://github.com/ryancooley "ryancooley (34 commits)")[![nolanpro](https://avatars.githubusercontent.com/u/2546850?v=4)](https://github.com/nolanpro "nolanpro (19 commits)")[![agustinbusso](https://avatars.githubusercontent.com/u/90727999?v=4)](https://github.com/agustinbusso "agustinbusso (13 commits)")[![tdondich](https://avatars.githubusercontent.com/u/3330334?v=4)](https://github.com/tdondich "tdondich (8 commits)")[![velkymx](https://avatars.githubusercontent.com/u/535300?v=4)](https://github.com/velkymx "velkymx (7 commits)")[![caleeli](https://avatars.githubusercontent.com/u/8028650?v=4)](https://github.com/caleeli "caleeli (3 commits)")[![sanjacornelius](https://avatars.githubusercontent.com/u/52755494?v=4)](https://github.com/sanjacornelius "sanjacornelius (3 commits)")[![boliviacoca](https://avatars.githubusercontent.com/u/74792291?v=4)](https://github.com/boliviacoca "boliviacoca (3 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (2 commits)")[![eiresendez](https://avatars.githubusercontent.com/u/90741874?v=4)](https://github.com/eiresendez "eiresendez (2 commits)")[![gproly](https://avatars.githubusercontent.com/u/2754293?v=4)](https://github.com/gproly "gproly (1 commits)")[![processmaker-bot](https://avatars.githubusercontent.com/u/206180840?v=4)](https://github.com/processmaker-bot "processmaker-bot (1 commits)")[![marcoAntonioNina](https://avatars.githubusercontent.com/u/1747025?v=4)](https://github.com/marcoAntonioNina "marcoAntonioNina (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/processmaker-pmql/health.svg)

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

###  Alternatives

[anourvalar/eloquent-serialize

Laravel Query Builder (Eloquent) serialization

11223.5M33](/packages/anourvalar-eloquent-serialize)[statamic-rad-pack/runway

Eloquently manage your database models in Statamic.

135224.7k7](/packages/statamic-rad-pack-runway)[api-platform/laravel

API Platform support for Laravel

58171.5k14](/packages/api-platform-laravel)[duncanmcclean/statamic-cargo

Comprehensive e-commerce addon for Statamic. Build bespoke e-commerce sites without the complexity.

3416.9k](/packages/duncanmcclean-statamic-cargo)

PHPackages © 2026

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