Edit this page

Telerik® UI for PHP by Progress

Telerik UI for PHP is a set of PHP classes which help you configure Kendo UI widgets by using server-side code in PHP web sites.

Getting Started

Requirements

  • Telerik UI for PHP requires a PHP 5.3.3+ version.
  • The sample application uses PDO and SQLite. Both extensions should be enabled in the PHP configuration (php.ini).
  • The phpinfo function can be used to verify that PDO and the SQLite extensions are successfully installed.

Download and Install

You can download Telerik UI for PHP from the official download page. The distribution .zip file contains the following directories:

  • /js—These are the minified JavaScript files.
  • /styles—The minified CSS files and background images used by the themes.
  • /src—The JavaScript and CSS source files. Not available in the trial version.
  • /wrappers/php/lib/Kendo/—The PHP files required to use Telerik UI for PHP.
  • /wrappers/php/—The sample PHP web site.

Sample Application Setup

Prerequisites

You can find a sample PHP web site in the /wrappers/php/ directory of the Telerik UI for PHP distribution. To run the web site, copy this directory to your web root. Then navigate to index.php.

Configuration

To use Telerik UI for PHP in your PHP web site, follow the steps below:

Step 1 Copy /wrappers/php/lib/Kendo to your web site root, e.g. to your lib directory.

Step 2 Copy the Kendo UI JavaScript and CSS files from /js and /styles to your web site root. If you prefer to use Kendo UI CDN Service, skip this step and the following ones, and check the article on the JavaScript dependencies.

Step 3 Include the Kendo UI JavaScript and CSS files in your PHP page.

Example
    <link href="styles/kendo.common.min.css" rel="stylesheet" type="text/css" />
    <link href="styles/kendo.default.min.css" rel="stylesheet" type="text/css" />
    <script src="js/jquery.min.js"></script>
    <script src="js/kendo.web.min.js"></script>

Important

If you want to use Kendo UI widgets for the web, including the ones that render data visualization, at the same time, you should include kendo.all.min.js instead of kendo.web.min.js and kendo.dataviz.min.js. You can also create a custom JavaScript file by using the Custom Download Builder.

Step 4 Include the Kendo PHP Autoload file.

Example
    <?php require_once 'lib/Kendo/Autoload.php'; ?>

Step 5 Use any Kendo UI PHP wrapper.

Example
    <?php
    // Instantiate a new instance of the DatePicker class and specify its 'id'
    $datepicker = new \Kendo\UI\DatePicker('datepicker');

    // Configure the datepicker using the fluent API
    $datepicker->start('year')
               ->format('MMMM yyyy');

    // Output the datepicker HTML and JavaScript by echo-ing the result of the render method
    echo $datepicker->render();
    ?>

The example below demonstrates the complete source code.

Example
<!DOCTYPE html>
<html>
    <head>
        <link href="styles/kendo.common.min.css" rel="stylesheet" type="text/css" />
        <link href="styles/kendo.default.min.css" rel="stylesheet" type="text/css" />
        <script src="js/jquery.min.js"></script>
        <script src="js/kendo.web.min.js"></script>
    </head>
    <body>
    <?php require_once 'lib/Kendo/Autoload.php'; ?>
    <?php
    // Instantiate a new instance of the DatePicker class and specify its 'id'
    $datepicker = new \Kendo\UI\DatePicker('datepicker');

    // Configure the datepicker using the fluent API
    $datepicker->start('year')
               ->format('MMMM yyyy');

    // Output the datepicker HTML and JavaScript by echo-ing the result of the render method
    echo $datepicker->render();
    ?>
    </body>
</html>

Next Steps

Watch the video tutorials on getting started with Telerik UI for PHP in the Kendo UI YouTube channel:

For more examples on how to use Kendo UI with PHP server-side wrappers, visit the GitHub repository with the collected Kendo UI examples on using PHP.

See Also

Other articles on Telerik UI for PHP: