Search code examples
javascriptsymfonynoty

Link javascript from external bundle (noty) in Symfony, no AppKernel


I want to use the noty bundle but I can not find a guide. From my understanding I only need to link to it from the bundle. In old questions, people recommend to add it to AppKernel but this bundle does not have *.php in the root path.

I want to keep the path of bundle and I don't want move to web folder.


Solution

  • As far as I can see, noty is a library, not a bundle (I assume you're using https://packagist.org/packages/needim/noty).

    A bundle is specifically built for Symfony, so the correct way to use is to include in in AppKernel.php as someone else mentioned.

    A library is not specifically built for Symfony, so you just include it via Composer and then (since it's a jQuery plugin) you'll have to initialize it in your Twig base template and use it as you wish.