Installation and usage guide.

Getting Started

Install the package by running

composer require robinn/uikit


Initialize UI Kit and then call methods or simply use get_ui() helper function.

Components can be loaded in several ways. It's up to you what you choose.

use RobiNN\UiKit\UiKit;

$uikit = new UiKit();


// ...


$uikit-> can be replaced by get_ui()-> function, or simply use for everything helper functions.

Note: when using get_ui() and you want custom config, you have to redeclare this function.


Simply print everything with echo.


echo 'HTML code';
echo alert('Default');

echo layout(ob_get_clean(), [
    'title' => 'Site title',

In template

It is also possible to call components in a template.

$html = get_ui()
    ->addPath(__DIR__.'/templates') // Path to dir with custom templates
    ->render('page'); // page.twig in templates/ dir

echo layout($html, [
    'title' => 'Site title',


HTML code
{{ alert('Default') }}


If you use components with helper functions, the simplest way to change config is to override get_ui() function.

Simply place this function after class autoload.

function get_ui(): RobiNN\UiKit\UiKit {
    return RobiNN\UiKit\UiKit::getInstance([
        'cache'  => __DIR__.'/cache',

All options can be found here.

layout() is not required and components can be used in any project that uses a compatible CSS framework.


  • PHP 8.2 or higher