Search code examples
javascriptphpsymfonydatatablevendor

Symfony DataTables [Js] Composer


I am starting to be comfortable with Symfony and the MVC model. But, I would like to know which is the best way to install and Datables with symfony.

First of all, I try to avoid downloading manualy Js plugins and put all of them in my Src/Bundle/Ressources/Js/. I want to download them with composer.

For instance, I went to Packagist.org and download this : https://packagist.org/packages/datatables/datatables. By exécuting the command : composer require datatables/datatables.

The problem is composer placed this package in the vendor folder.

I want to know which the cleanest and the best way to include the js in my twig page.

Can anyone manianc like me (actualy anyone) can help me with solution, a walkthough.... ? :P

Thanks a lot in advance Good day


Solution

  • I think I found the answer even before this posts... but I was blocked by a syntax error... There is simple example here in the symfony documentation.

    app/config/config.yml

    assetic: assets: jquery_and_ui: inputs: - '@AppBundle/Resources/public/js/thirdparty/jquery.js' - '@AppBundle/Resources/public/js/thirdparty/jquery.ui.js'

    The problems in the recent verision you have to put the full name of the bundle. Like "JoeAppBundle". Do you think it's normal ?

    Good day