Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Need help to install a parser, please
  • Hey,

    I am trying to use twig as a parser in fuelphp and I already got it installed but I still run into
    a little problem...

    In /fuel/app/config/config.php I uncommented the 'always_load' part and changed it to the following:

    'always_load'  => array(
    'packages'  => array(
                'twig',
    ),
    ),

    But when I save it and refresh my project, I get the following error:

    image

    And this is where my twig folder (installed via composer) is located:

    ==> /fuel/vendor

    Please help me?
    Thanks!
  • There is no "twig" package, the package is called "parser".

    If you installed twig using composer, it will be able to find and use it automatically, if you give your views the ".twig" extension.
  • Okay so I changed 'twig' in the always_load array back to 'parser', and if I am right, now I just have to changes the extensions of all .php files in the views folder to .twig?
  • You don't have to, if you want to use twig as the parser for all your templates, and you will never use standard templates anymore, you can also configure the parser to map the .php extension to twig. But that means you also have to create twig templates for all views in fuel/core.
  • Okay, but it still doesn't seem to be working... I changed 'twig' back to 'parser' but I can't use twig...
    I just don't think I am doing it right, can you maybe give me a quick tutorial on how to install a parser?
    I don't understand the one in the documents of fuelphp
  • lexxkrtlexxkrt
    Accepted Answer
    install `twig` at first
    composer require twig/twig

    http://indoallcode.com/install-twig-on-fuelphp
  • I assumed that had already happened. In the first post it said "And this is where my twig folder (installed via composer) is located"...

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion