Fork me on GitHub

The Symfony plugin


This example shows the usage of the Jaxon plugin for the Symfony framework.

The configuration file, the classes and the views are found here.

How it works

Install and configure the Jaxon plugin for Symfony, as described in the plugin documentation.

In the application controller, insert the code generated by Jaxon in the page.

namespace AppBundle\Controller;

use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;

class DemoController extends Controller
{
    public function indexAction(Request $request)
    {
        // Register the Jaxon classes
        $jaxon = $this->get('jaxon.ajax');
        $jaxon->register();
        // Print the page
        return $this->render('demo/index.html.twig',
            'jaxonCss' => $jaxon->css(),
            'jaxonJs' => $jaxon->js(),
            'jaxonScript' => $jaxon->script()
        ]);
    }
}

Demo