PHP Classes


Recommend this page to a friend!
  Classes of Tomas Saghy   Kendo UI PHP Framework   Download  
Role: Documentation
Content type: text/markdown
Description: Documentation
Class: Kendo UI PHP Framework
Build user interface with Telerik Kendo UI library
Author: By
Last change:
Date: 7 years ago
Size: 4,710 bytes


Class file image Download

PHP wrapper for Kendo UI widgets

Build Status Latest Version Total Downloads Software License

Kendo UI is a great JavaScript library. It offers both open-source and commercial editions.

This library provides a wrapper for all Kendo UI widgets. Telerik provides PHP wrappers itself, but these are unnecessarily complex and in addition they are payed. Our library is released under the MIT license, so you are free to use it in any project (even commercial projects) as long as the copyright header is left intact.


Install the latest version using composer require riesenia/kendo

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

    "require": {
        "riesenia/kendo": "~1.0"


Any widget can be created calling the create method of Kendo class. For example creating a grid with selector "#grid" (resulting in $("#grid").kendoGrid({ ... }) can be achieved by calling:

use Riesenia\Kendo\Kendo; 

echo Kendo::create('Grid')->bindTo('#grid');

or faster by:

use Riesenia\Kendo\Kendo; 

echo Kendo::createGrid('#grid');

Setting properties

Any property can be set by calling set method. For adding to properties that are represented by array (or objects), add method can be used. Set method can be also used for batch assignment by passing array as the only parameter. To NOT encode passed data, pass them wrapped by Kendo::js() call. All the methods return the instance so calls can be chained. Examples:

use Riesenia\Kendo\Kendo; 

$grid = Kendo::createGrid('#grid');

// set any property

// set property, that should not be encoded
$grid->setChange(Kendo::js('function(e) {

// set properties by array
    'height' => 100,
    'change' => Kendo::js('function(e) {

// add to property
$grid->addColumns(null, 'Name')
    ->addColumns(null, ['field' => 'Surname', 'encoded' => false]);

// pass DataSource object

Complex example

Creating code for grid as in this example:

use Riesenia\Kendo\Kendo; 

$model = Kendo::createModel()
    ->addField('ProductName', ['type' => 'string'])
    ->addField('UnitPrice', ['type' => 'number'])
    ->addField('UnitsInStock', ['type' => 'number'])
    ->addField('Discontinued', ['type' => 'boolean']);

$dataSource = Kendo::createDataSource()
    ->setSchema(['model' => $model])

echo Kendo::createGrid('#grid')
    ->setPageable(['input' => true, 'numeric' => false])
        ['field' => 'UnitPrice', 'title' => 'Unit Price', 'format' => '{0:c}', 'width' => '130px'],
        ['field' => 'UnitsInStock', 'title' => 'Units In Stock', 'width' => '130px'],
        ['field' => 'Discontinued', 'width' => '130px']

Observable (MVVM)

Rendering for Kendo observable is slightly different. Predefined variable name is viewModel, but this can be overridden by the method variableName. Example:

use Riesenia\Kendo\Kendo; 

echo Kendo::createObservable('#view')
    ->setDisplayGreeting(Kendo::js('function() {
        alert("Hello, " + this.get("firstName") + " " + this.get("lastName") + "!!!");

This will output:

myMvvm = kendo.observable({
    "firstName": "John",
    "lastName": "Doe",
    "displayGreeting": function () {
        alert("Hello, " + this.get("firstName") + " " + this.get("lastName") + "!!!");
kendo.bind($("#view"), myMvvm);


You can run the unit tests with the following command:

$ cd path/to/riesenia/kendo
$ composer install
$ vendor/bin/phpspec run