Skip to content


Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time

JQL Builder

GitHub Workflow Status (master) Total Downloads Latest Version License

JQL builder is a supercharged PHP package that allows you to create Jira Query Language (JQL).

Get Started

Requires PHP 8.0+

First, install devmoath/jql-builder via the Composer package manager:

composer require devmoath/jql-builder

Then, interact with JQL builder:

$query = new Jql();

$query->where('project', 'PROJECT')->where('summary', '~', 'title');

echo $query; // 'project = "PROJECT" and summary ~ "title"'


This is how to generate query:

use JqlBuilder\Jql;

$builder = new Jql();

// Simple query
$query = $builder->where('project', 'MY PROJECT')->getQuery();

echo $query;
// 'project = "MY PROJECT"'

$builder = new Jql();

// Complex query
$query = $builder->where('project', 'MY PROJECT')
    ->where('status', ['New', 'Done'])
    ->orWhere('summary', '~', 'sub-issue for "TES-xxx"')
    ->orWhere('labels', 'support')
    ->when(false, fn (Jql $builder, mixed $value) => $builder->where('creator', 'admin'))
    ->when(true, fn (Jql $builder, mixed $value) => $builder->where('creator', 'guest'))
    ->orderBy('created', 'asc')

echo $query;
// 'project = "MY PROJECT" and status in ("New", "Done") or summary ~ "sub-issue for \"TES-xxx\"" or labels = "support" and creator = "guest" order by created asc'

Also, you can add macro functions as well to encapsulate your logic:

use JqlBuilder\Jql;

$builder = new Jql();

$builder::macro('whereCustom', function (mixed $value) {
     * your code...
    /** @var Jql $this */
    return $this->where('custom', $value);

$query = $builder->whereCustom('1')->getQuery();

echo $query;
// 'custom = "1"'

laravel facade support out of the box:

use JqlBuilder\Facades\Jql;

$query = Jql::where('summary', '=', 'value')->getQuery();

echo $query;
// 'summary = "value"'

JQL builder is an open-sourced software licensed under the MIT license.