How to clear cache automatically on symfony?

  php, symfony

When i create a new route by this :

 * @Route("/restaurant/", name="restaurant")
     * @Route("/work/", name="work")
     * @return Response
     */

for example and when i launch /work/ symfony returns

Unable to parse file "/Applications/XAMPP/xamppfiles/htdocs/apps/symfony/vendor/sensio/framework-extra-bundle/src/DependencyInjection/../Resources/config/annotations.xml": The XML file "/Applications/XAMPP/xamppfiles/htdocs/apps/symfony/vendor/sensio/framework-extra-bundle/src/DependencyInjection/../Resources/config/annotations.xml" is not valid.

and i have to clear cache with : php bin/console cache:clear -v
and then it works

how can i fix it ?

Source: Ask PHP

LEAVE A COMMENT