PHPackages                             riesenia/utility - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. riesenia/utility

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

riesenia/utility
================

Riesenia Utility Classes

v3.3.1(2y ago)336.8k↓27.3%7[1 issues](https://github.com/riesenia/utility/issues)MITPHPPHP &gt;=7.1

Since Dec 22Pushed 2y ago1 watchersCompare

[ Source](https://github.com/riesenia/utility)[ Packagist](https://packagist.org/packages/riesenia/utility)[ RSS](/packages/riesenia-utility/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (7)Versions (54)Used By (0)

Riesenia Utility Classes
========================

[](#riesenia-utility-classes)

[![Build Status](https://camo.githubusercontent.com/a0f6e4485921aafc70d835faba70eb2bca02599fc6a126119baaa06bbb92efaa/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f72696573656e69612f7574696c6974792f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/riesenia/utility)[![Latest Version](https://camo.githubusercontent.com/9198979ae67251cd546d7c14eca1979e3271efc5cba57ae21c94196e70ec150a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f72696573656e69612f7574696c6974792e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/riesenia/utility)[![Total Downloads](https://camo.githubusercontent.com/6a1b3bdb6131bae602185c727ec8c61d8f21acaa3c63e844d3bbcbad05da880c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f72696573656e69612f7574696c6974792e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/riesenia/utility)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)

This library provides a range of utility classes.

Installation
------------

[](#installation)

Install the latest version using `composer require riesenia/utility`

Or add to your *composer.json* file as a requirement:

```
{
    "require": {
        "riesenia/utility": "~3.0"
    }
}
```

*Note: if you use PHP 5.4 - 5.6 use 1.\* version of this library.*

Kendo
-----

[](#kendo)

Helpers simplifying usage of Kendo UI components.

### Table

[](#table)

```
use Riesenia\Utility\Kendo\Table;

$table = Table::create('myTableId');

// datasource can be accessed directly
$table->dataSource->addTransport('read', ['dataType' => 'json', 'url' => 'URL']);

// ... but addTransport can also be called directly on the table object
$table->addTransport('update', ['dataType' => 'json', 'url' => 'URL']);

// columns can have various types and additional options can be set
$table->addColumn('name', 'Product name')
    ->addColumn('price', 'Product price', 'price', ['class' => 'green'])
    ->addColumn('active', 'Is active?', 'checkbox')
    ->addColumn('stock', 'Stock', 'number');

// checkboxes for batch operations can be added
$table->addCheckboxes();

// class for table row can be added using 'addRowClass' method
$table->addRowClass('#: active ? "active" : "not-active" #');

// additional model options can be set using 'model' key
$table->addColumn('name', 'Product name', null, ['model' => ['editable' => false]]);

// you can use any custom column rendering class
// as long as it extends Riesenia\Utility\Kendo\Table\Column\Base
$table->addColumn('custom_field', 'Title', '\\Custom\\Rendering\\Class');

// link is built-in option
$table->addColumn('...', '...', '...', ['link' => 'URL']);

// any link attributes can be set
$table->addColumn('...', '...', '...', ['link' => ['href' => 'URL', 'title' => 'TITLE']]);

// the whole template can be overridden
$table->addColumn('...', '...', '...', ['template' => '# if (field) { # yes # } else { # no # } #']);

// it is possible to hide columns under certain table width
$table->addColumn('...', '...', '...', ['display' => 700]);

// actions are usually icons with links
// icons are bootstrap classes without glyphicon prefix
$table->addAction(null, [
    'icon' => 'music',
    'link' => 'URL',
    'title' => 'Play!'
]);

// or predifined edit or delete operation
$table->addAction('delete');

// you can use any custom column action class
// as long as it extends Riesenia\Utility\Kendo\Table\Action\Base
$table->addAction('\\Custom\\Action\\Class');

// generally used classes can be aliased, so previous example is equivalent to
Table::alias('alias_name', '\\Custom\\Action\\Class');
$table->addAction('alias_name');

// condition is built-in option
$table->addAction('...', ['condition' => 'count > 0']);

// set text for no results (will be added as first colspaned row)
$table->setNoResults('NO RESULTS!');

// html element (div)
echo $table;

// generated javascript
echo '' . $table->script() . '';
```

### Tree

[](#tree)

```
use Riesenia\Utility\Kendo\Tree;

$tree = Tree::create('myTreeId');

// datasource can be accessed directly
$tree->dataSource->addTransport('read', ['dataType' => 'json', 'url' => 'URL']);

// ... but addTransport can also be called directly on the tree object
$tree->addTransport('delete', ['dataType' => 'json', 'url' => 'URL']);

// add hasChildren field (to allow tree expanding), default field name is 'hasChildren'
// but any field name can be passed (do not use 'children' as field name)
$tree->hasChildren();

// html element (div)
echo $tree;

// generated javascript
echo '' . $tree->script() . '';
```

### Window

[](#window)

```
use Riesenia\Utility\Kendo\Window;

$window = Window::create('myWindowId');

// html element (div)
echo $window;

// generated javascript
echo '' . $window->script() . '';

// method for opening window is automatically defined
echo 'myWindowIdOpen("WINDOW TITLE", "URL OF THE CONTENT TO LOAD");';
```

### Tabber

[](#tabber)

```
use Riesenia\Utility\Kendo\Tabber;

$tabber = Tabber::create('myTabberId');

// adding remote tab
$tabber->addRemoteTab('First tab', 'URL');

// active tab is set using third parameter
$tabber->addRemoteTab('Second tab', 'URL', true);

// html element (div & ul)
echo $tabber;

// generated javascript
echo '' . $tabber->script() . '';
```

### Upload

[](#upload)

```
use Riesenia\Utility\Kendo\Upload;

$upload = Upload::create('myUploadId');

// optionally set any attribute of the input
$upload->addAttribute('name', 'NAME');

// html element (input type file)
echo $upload;

// generated javascript
echo '' . $upload->script() . '';
```

### Select

[](#select)

```
use Riesenia\Utility\Kendo\Select;

$select = Select::create('mySelectId');

// datasource can be accessed directly
$select->dataSource->addTransport('read', ['dataType' => 'json', 'url' => 'URL']);

// ... but addTransport can also be called directly on the select object
$select->addTransport('read', ['dataType' => 'json', 'url' => 'URL']);

// optionally set any attribute of the input
$select->addAttribute('name', 'NAME');

// html element (input)
echo $select;

// generated javascript
echo '' . $select->script() . '';
```

### ListView

[](#listview)

```
use Riesenia\Utility\Kendo\ListView;

$listView = ListView::create('myListViewId');

// datasource can be accessed directly
$listView->dataSource->addTransport('read', ['dataType' => 'json', 'url' => 'URL']);

// ... but addTransport can also be called directly on the listView object
$listView->addTransport('destroy', ['dataType' => 'json', 'url' => 'URL']);

// template can be set by id attribute
$listView->setTemplateById('ID');

// html element (div)
echo $listView;

// generated javascript
echo '' . $listView->script() . '';
```

### Date / DateTime

[](#date--datetime)

```
use Riesenia\Utility\Kendo\DateTime;

$dateTime = DateTime::create('myDateTimeId');

// range can be set between two elements (two fields with ids 'from' and 'to')
DateTime::create('from')->rangeTo('to');
DateTime::create('to')->rangeFrom('from');

// optionally set any attribute of the input
$dateTime->addAttribute('name', 'NAME');

// html element (input)
// hidden input with same name is added automatically to provide MySQL datetime format
echo $dateTime;

// generated javascript
echo '' . $dateTime->script() . '';
```

Traits
------

[](#traits)

Various traits providing useful methods.

### ParseDecimalTrait

[](#parsedecimaltrait)

Adds a protected *\_parseDecimal()* method that transforms input to float replacing spaces, commas, etc.

Condition
---------

[](#condition)

Condition (query) parsers.

### QueryEvaluator

[](#queryevaluator)

Returns array that can be passed to CakePHP Query builder as a condition.

```
use Riesenia\Utility\Condition\QueryEvaluator;

// available fields and operators are defined during consstruction
$evaluator = new QueryEvaluator([
    'pid' => [
        'field' => 'id',
        'operators' => ['=', 'NOT', 'IN', 'NOTIN']
    ],
    'name' => [
        'field' => 'name',
        'operators' => ['=', 'NOT', 'CONTAINS']
    ],
    'price' => [
        'field' => 'unit_price',
        'operators' => ['>=', '>', '= 10'); // ['unit_price >=' => '10']

// use AND / OR operators
$evaluator->parse('pid IN 2, 3 AND price >= 10'); // ['AND' => [['id IN' => ['2', '3']], ['unit_price >=' => '10']]]

// use parenthesis for complex conditions
$evaluator->parse('pid IN 2, 3 AND ((price >= 10 OR name = x) OR name CONTAINS y)'); // ... see tests

// throws custom exception for incorrect query
use Riesenia\Utility\Condition\QueryEvaluatorException;

try {
    $evaluator->parse('(pid = 56');
} catch(QueryEvaluatorException $e) {
    if ($e->getCode() == QueryEvaluatorException::MISSING_CLOSING_PARENTHESIS) { // true
        echo $e->getAttributes()['position']; // 0
    }
}
```

### QueryEvaluatorCallable

[](#queryevaluatorcallable)

Returns function that evaluates all attributes of passed array / ArrayAccess returning boolean result.

```
use Riesenia\Utility\Condition\QueryEvaluatorCallable;

// using configuration from previous example
$evaluator = new QueryEvaluatorCallable([...]);

$condition = $evaluator->parse('pid IN 2, 3 AND price >= 10');

$condition(['id' => 2, 'unit_price' => 7]); // true
$condition(['id' => 4, 'unit_price' => 7]); // false
$condition(['unit_price' => 4]); // false
```

### QueryEvaluatorCart

[](#queryevaluatorcart)

Returns function that evaluates aggregates condition for *riesenia/cart* package.

### QueryEvaluatorTwofold

[](#queryevaluatortwofold)

Allows passing prefixed condition.

```
use Riesenia\Utility\Condition\QueryEvaluatorTwofold;

// using configuration from previous example
$evaluator = new QueryEvaluatorTwofold([
    'P1' => [
        'pid' => [
            'field' => 'id',
            'operators' => ['=', 'NOT', 'IN', 'NOTIN']
        ],
        'name' => [
            'field' => 'name',
            'operators' => ['=', 'NOT', 'CONTAINS']
        ],
        'price' => [
            'field' => 'unit_price',
            'operators' => ['>=', '>', '=', '>', '= P2.price'); // ['AND' => [['P1.id IN' => ['2', '3']], ['P1.unit_price >= P2.unit_price']]]
```

###  Health Score

37

—

LowBetter than 83% of packages

Maintenance13

Infrequent updates — may be unmaintained

Popularity34

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity72

Established project with proven stability

 Bus Factor1

Top contributor holds 89% of commits — single point of failure

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

Recently: every ~292 days

Total

51

Last Release

833d ago

Major Versions

v1.3.0 → v2.0.02017-10-23

v1.3.2 → v3.0.02018-01-25

PHP version history (3 changes)v1.0.0PHP &gt;=5.4

v2.0.0PHP &gt;=7.0

v3.0.0PHP &gt;=7.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/40c7ed7cfaebeddae57ac4a376c8f21df56dd2f38821b7ba92ea1312ef8020c8?d=identicon)[riesenia](/maintainers/riesenia)

---

Top Contributors

[![segy](https://avatars.githubusercontent.com/u/1355459?v=4)](https://github.com/segy "segy (145 commits)")[![johnd-cloud](https://avatars.githubusercontent.com/u/75111916?v=4)](https://github.com/johnd-cloud "johnd-cloud (11 commits)")[![webmacaj](https://avatars.githubusercontent.com/u/11817798?v=4)](https://github.com/webmacaj "webmacaj (4 commits)")[![ipinfil](https://avatars.githubusercontent.com/u/20513861?v=4)](https://github.com/ipinfil "ipinfil (2 commits)")[![Masaker000](https://avatars.githubusercontent.com/u/6486181?v=4)](https://github.com/Masaker000 "Masaker000 (1 commits)")

###  Code Quality

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/riesenia-utility/health.svg)

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

###  Alternatives

[tatter/themes

Lightweight theme manager for CodeIgniter 4

1710.2k2](/packages/tatter-themes)

PHPackages © 2026

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