omegacode/symfony-fluid-integration

Integrates the template engine fluid into symfony 4 projects.

0.5.0 2018-10-17 17:28 UTC

README

! This is currently work in progress. !

Description

Integrates the template engine fluid into symfony 4 projects.

Setup

Open the file config/services.yaml and add the following:

services:
  templating.engine.fluid:
    public: true
    autowire: true
    class: OmegaCode\FluidIntegration\FluidEngine
    arguments:
    - '@kernel'
    - '@omega_code_fluid_integration.settings'

Next, open the file config/packages/framework.yaml and add the following:

framework:
  templating:
    engines: ['fluid', 'twig', 'php']

Finally open the file config/bundles.php and add the bundle:

<?php
return [
    ...
    OmegaCode\FluidIntegration\OmegaCodeFluidIntegrationBundle::class => ['all' => true],
    ...
];

You are now able to render fluid templates in your controller:

class DemoController extends \Symfony\Bundle\FrameworkBundle\Controller\AbstractController
{
    public function indexAction()
    {
        return $this->render('demo/index.html', [
            'var' => 'val'
        ]);
    }
}

View helper - Auto complete for your IDE

To enable auto complete in your IDE for the custom symfony-fluid-integration view helpers, add the following URL:http://omega-code.de/ViewHelperSchemas/schema.xsd