The Making of Hari.Extras

If you have read my earlier posts, you know I started to love templating library like Twig, Mustache etc. So I was interested to in-corporate Twig or PhlyMustache or any sort of templating library to auraphp.

Aura.Web makes it easy to do without much hassle. What you want to do is create the class which extends the Aura\Web\Renderer\AbstractRenderer and have a exec() method. For more details checkout Data and Rendering

namespace Vendor\Package\Web\Renderer;

use Aura\Web\Renderer\AbstractRenderer;

class YourRender extends AbstractRenderer
    public function exec()

And you should pass an object of Vendor\Package\Web\Renderer\YourRender to your controller.

Currently I have added support for Twig in Hari.Extras . I will be adding support for PhlyMustache in the coming days. Hari.Extras comes with unit tests.

Running unit tests : To run tests you should first install the dependencies. You can run {syntaxhighlighter class=“php”}composer.phar install —dev{/syntaxhighlighter} This will install the dependencies like Aura.Web, Aura.Framework, Twig, vfsstream etc in vendor folder. Now you can run the phpunit from tests folder.

A big Thanks to @Paul M Jones and Chris Hartjes and all who have supported one way or the other giving me tips and tricks, motivation to make this happen. The nice thing is with composer for I don’t need to keep everything in the tests folder. Thanks to @Jordi

By the way as auraphp is getting closer and closer for the next release I am planning to start a series of posts to get started with using the components. Stay tuned :) .

auraphp, composer, twig