1. Go to this page and download the library: Download bbs-lab/jql-builder library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
bbs-lab / jql-builder example snippets
use JqlBuilder\Jql;
$query = new Jql();
$query->where('project', 'PROJECT')
->where('summary', '~', 'title');
echo $query; // project = "PROJECT" and summary ~ "title"
$query = new Jql();
// Using default operator (=)
$query->where('project', 'MY PROJECT');
// project = "MY PROJECT"
// Using a specific operator
$query->where('summary', '~', 'some text');
// summary ~ "some text"
// Using an array of values (IN operator)
$query->where('status', ['New', 'In Progress', 'Done']);
// status in ("New", "In Progress", "Done")
$query = new Jql();
$query->where('project', 'MY PROJECT')
->orWhere('summary', '~', 'sub-issue for "TES-xxx"');
// project = "MY PROJECT" or summary ~ "sub-issue for \"TES-xxx\""
$query = new Jql();
$query->where('project', 'MY PROJECT')
->orderBy('created', 'asc');
// project = "MY PROJECT" order by created asc
$query = new Jql();
$onlyOpen = true;
$query->where('project', 'MY PROJECT')
->when($onlyOpen, function (Jql $builder) {
$builder->where('status', 'Open');
});
// project = "MY PROJECT" and status = "Open"
use JqlBuilder\Jql;
Jql::macro('forProject', function (string $project) {
/** @var Jql $this */
return $this->where('project', $project);
});
$query = new Jql();
$query->forProject('MY PROJECT')
->where('status', 'Open')
->getQuery();
// project = "MY PROJECT" and status = "Open"
$query = new Jql();
$result = $query->where('project', 'MY PROJECT')
->where('status', ['New', 'Done'])
->orWhere('summary', '~', 'sub-issue for "TES-xxx"')
->orderBy('created', 'asc')
->getQuery();
echo $result;
// project = "MY PROJECT" and status in ("New", "Done") or summary ~ "sub-issue for \"TES-xxx\"" order by created asc
use JqlBuilder\Facades\Jql;
$query = Jql::where('project', 'MY PROJECT')
->where('status', 'Open')
->getQuery();
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.