PHPackages                             yepsua/smartwig - 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. yepsua/smartwig

ActiveLibrary

yepsua/smartwig
===============

Ultimate Components Extension for Twig.

v1.1.0(11y ago)63.2k↓100%11MITPHP

Since Jan 15Pushed 9y ago1 watchersCompare

[ Source](https://github.com/oyepez003/smartwig)[ Packagist](https://packagist.org/packages/yepsua/smartwig)[ Docs](http://smartwig.yepsua.com)[ RSS](/packages/yepsua-smartwig/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (2)Versions (5)Used By (1)

SmarTwig
========

[](#smartwig)

Ultimate Components Extension for Twig.

You can use Twig and SmarTwig and any PHP Project.

Installation
============

[](#installation)

You can install the SmarTwig in 2 different ways:

1. Use the [Git repository](https://github.com/oyepez003/smartwig)
2. Install it via Composer on [Packagist](https://packagist.org/packages/yepsua/smartwig)

The Assets:
-----------

[](#the-assets)

All the SmarTwig Components need some .css and .js files to work.

Get the resources cloning the [Git repository](https://github.com/oyepez003/jquery4php-assets) or \[ Download the Zip\] ()

Put content of the repo in your app public folder.

How To Use (3 Ways)
===================

[](#how-to-use-3-ways)

1. The Ugly Way:

---

Load all Extensions and the Builders Configuration step by step.

```
require_once 'vendor/autoload.php';

$loader = new Twig_Loader_Filesystem('templates');
$twig = new Twig_Environment($loader, array(
    'cache' => 'cache',
	'debug' => true // Only for dev enviroment.
));

$coreExt = new Yepsua\SmarTwig\Twig\Extension\UICoreExtension();
$coreExt->setBuilders(array(
          "ui.html" => "YsHTML",
          "ui.jqueryCore"  => "YsJQuery",
          "ui.dialog"  => "YsUIDialog",
          "ui.tabs"  => "YsUITabs",
          "ui.accordion"  => "YsUIAccordion",
          "ui.progressbar"  => "YsUIProgressbar",
          "ui.slider"  => "YsUISlider",
          "ui.autocomplete"  => "YsUIAutocomplete",
          "ui.datepicker"  => "YsUIDatepicker",
          "ui.datetimepicker"  => "YsUIDateTimepicker",
          "ui.button"  => "YsUIButton",
          "ui.multiselect"  => "YsUIMultiSelect",
          "ui.picklist"  => "YsUIPickList",
          "ui.popup"  => "YsUIPopUp",
          "ui.selectmenu"  => "YsUISelectMenu",
          "ui.expander"  => "YsUIExpander",
          "ui.splitter"  => "YsUISplitter",
          "ui.dynaselect"  => "YsUIDynamicSelect",
          "ui.menu"  => "YsUIMenu",
          "ui.panel"  => "YsUIPanel",
          "ui.tooltip"  => "YsUITooltip",
          "ui.draggable"  => "YsUIDraggable",
          "ui.droppable"  => "YsUIDroppable",
          "ui.resizable"  => "YsUIResizable",
          "ui.effect"  => "YsUIEffect",
          "ui.video"  => "YsUIVideo"
));

$uiAddonsExt = new Yepsua\SmarTwig\Twig\Extension\UIAddonsExtension();
$uiAddonsExt->setBuilders(array(
	"ui.block" => "YsBlockUI",
	"ui.box" => "YsJQBox",
	"ui.colorpicker" => "YsJQColorPicker",
	"ui.notify" => "YsPNotify",
	"ui.hotkey" => "YsKeys",
	"ui.monitor" => "YsJQMonitor",
	"ui.keypad" => "YsJQKeypad",
	"ui.calculator" => "YsJQCalculator",
	"ui.layout" => "YsJLayout",
	"ui.mask" => "YsJQMask",
	"ui.formWizard" => "YsFormWizard",
	"ui.ajaxForm" => "YsJQForm",
	"ui.validation" => "YsJQValidate",
	"ui.booklet" => "YsJQBooklet",
	"ui.cycle" => "YsJQCycle",
	"ui.ring" => "YsJQRing",
	"ui.upload" => "YsUpload",
));

//Set all extension to Twig

$twig->setExtensions(array(
	new Yepsua\SmarTwig\Twig\Extension\HTMLExtension(),
	new Yepsua\SmarTwig\Twig\Extension\JsSintaxExtension(),
	new Yepsua\SmarTwig\Twig\Extension\JQueryCoreExtension(),
	new Yepsua\SmarTwig\Twig\Extension\UIWidgetExtension(),
	$coreExt,
	$uiAddonsExt
));
```

2. The Short Way:

---

Load all Extensions and the Builders Configuration in one line of code.

```
require_once 'vendor/autoload.php';

$loader = new Twig_Loader_Filesystem('templates');
$twig = new Twig_Environment($loader, array(
    'cache' => 'cache',
	'debug' => true // Only for dev enviroment.
));

$twig->setExtensions(
	Yepsua\SmarTwig\Twig\Extension\SmarTwigExtension::getAllExtensions()
);
```

3. The Pretty Way:

---

Load all Extensions and the Builders Configuration using The IoC Symfony Component.

You need add to your composer.json the next dependencies:

```
    "require": {
		"symfony/dependency-injection": "2.3.*@dev",
		"symfony/config": "2.4.*@dev",
		"yepsua/smartwig": "1.0.*"
    }
```

```
require_once 'vendor/autoload.php';

use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;

$container = new ContainerBuilder();
$loader = new XmlFileLoader($container, new FileLocator(__DIR__));
$loader->load('path/to/services.xml');

$twig = $container->get('twig');
```

Now you can write all the services configuration in the service.xml file:

```

    YsHTML
    YsJQuery
    YsHTML
    YsUIDialog
    YsUITabs
    YsUIAccordion
    YsUIProgressbar
    YsUISlider
    YsUIAutocomplete
    YsUIDatepicker
    YsUIDateTimepicker
    YsUIButton
    YsUIMultiSelect
    YsUIPickList
    YsUIPopUp
    YsUISelectMenu
    YsUIExpander
    YsUISplitter
    YsUIDynamicSelect
    YsUIMenu
    YsUIPanel
    YsUITooltip
    YsUIDraggable
    YsUIDroppable
    YsUIResizable
    YsUIEffect
    YsBlockUI
    YsJQBox
    YsJQColorPicker
    YsPNotify
    YsKeys
    YsJQMonitor
    YsJQKeypad
    YsJQCalculator
    YsJLayout
    YsJQMask
    YsFormWizard
    YsJQForm
    YsJQValidate
    YsJQBooklet
    YsJQCycle
    YsJQRing
    YsUIVideo
    YsUpload
	templates
	cache
	true

	  %twig.loader.filesystem.location%

		%twig.config.cache%
		%twig.config.debug%

          %html.builder.class%
          %jquery.core.builder.class%
          %jquery.ui.dialog.class%
          %jquery.ui.tabs.class%
          %jquery.ui.accordion.class%
          %jquery.ui.progressbar.class%
          %jquery.ui.slider.class%
          %jquery.ui.autocomplete.class%
          %jquery.ui.datepicker.class%
          %jquery.ui.datetimepicker.class%
          %jquery.ui.button.class%
          %jquery.ui.multiselect.class%
          %jquery.ui.picklist.class%
          %jquery.ui.popup.class%
          %jquery.ui.selectmenu.class%
          %jquery.ui.expander.class%
          %jquery.ui.splitter.class%
          %jquery.ui.dynaselect.class%
          %jquery.ui.menu.class%
          %jquery.ui.panel.class%
          %jquery.ui.tooltip.class%
          %jquery.ui.draggable.class%
          %jquery.ui.droppable.class%
          %jquery.ui.resizable.class%
          %jquery.ui.effect.class%
          %jquery.ui.video.class%

          %jquery.ui.blockui.class%
          %jquery.ui.box.class%
          %jquery.ui.colorpicker.class%
          %jquery.ui.notify.class%
          %jquery.ui.keys.class%
          %jquery.ui.monitor.class%
          %jquery.ui.keypad.class%
          %jquery.ui.calculator.class%
          %jquery.ui.layout.class%
          %jquery.ui.mask.class%
          %jquery.ui.formWizard.class%
          %jquery.ui.ajaxForm.class%
          %jquery.ui.validation.class%
          %jquery.ui.booklet.class%
          %jquery.ui.cycle.class%
          %jquery.ui.ring.class%
          %jquery.ui.upload.class%

```

This way is the most recommended for performance and scalability.

Basic Usage
===========

[](#basic-usage)

The /index.php content:

```
require_once 'vendor/autoload.php';

$loader = new Twig_Loader_Filesystem('templates');
$twig = new Twig_Environment($loader, array(
    'cache' => 'cache',
	'debug' => true // Only for dev enviroment.
));

$twig->setExtensions(
	Yepsua\SmarTwig\Twig\Extension\SmarTwigExtension::getAllExtensions()
);

echo $twig->render('index.html', array('name' => 'Fabien'));
```

The /templates/index.html content:

```

{% include 'path/to/jquery4php-assets/smartwigAssets.html' %}

	{% ui_dialog title="Hello World" %}
		The name is: {{ name }}
	{% end_ui_dialog %}

```

\###Info: The smartwigAssets.html is an example file for test all the SmarTwig Components, You must edit this file for include only that you need.

[![SmarTwig Showcase](https://camo.githubusercontent.com/096f602bb4f3ee5679cce183edf45ca40ac457cffd19b7b8d9ff69287dfde850/687474703a2f2f7331362e706f7374696d672e6f72672f6f6c337974363739682f736d6172747769672e706e67 "SmarTwig Showcase")](https://camo.githubusercontent.com/096f602bb4f3ee5679cce183edf45ca40ac457cffd19b7b8d9ff69287dfde850/687474703a2f2f7331362e706f7374696d672e6f72672f6f6c337974363739682f736d6172747769672e706e67)

The Sf2 Bundle
==============

[](#the-sf2-bundle)

If you are using Sf2 Framework we recommend the [SmarTwigBundle](https://github.com/oyepez003/YepsuaSmarTwigBundle)

Enjoy

[Showcase](http://smartwig-yepsua.rhcloud.com/)[Twig](http://www.twig-project.org/)[jQuery4PHP](http://jquery4php.sourceforge.net/)

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity23

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity66

Established project with proven stability

 Bus Factor1

Top contributor holds 96.6% 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 ~142 days

Total

4

Last Release

4070d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/21730da81fbe12e7626a7e1fa51fdd68f14e94c5b8d18e6a933e0a9ad379514c?d=identicon)[oyepez003](/maintainers/oyepez003)

---

Top Contributors

[![oyepez003](https://avatars.githubusercontent.com/u/1541517?v=4)](https://github.com/oyepez003 "oyepez003 (28 commits)")[![namreg](https://avatars.githubusercontent.com/u/391872?v=4)](https://github.com/namreg "namreg (1 commits)")

### Embed Badge

![Health badge](/badges/yepsua-smartwig/health.svg)

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

###  Alternatives

[sonata-project/entity-audit-bundle

Audit for Doctrine Entities

644989.8k1](/packages/sonata-project-entity-audit-bundle)

PHPackages © 2026

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