Symfony:加快前端开发人员的开发环境

I'm trying to create a development enviroment for the frontend developers. As long as they don't change any php code I thought it might be a good idea do this, if possible:

  1. Create a new entry point all app_frontend.php i.e., disabling the debug
  2. Create a config_frontend.yml file and cache php files generation but disable twig cache as well as js and css

Is there any way to do this? I'm not sure if it's possible

You can create as many environments as you want. After all, environments are just sets of different configuration, nothing more.

This means that if you want to create a frontend environment, you have to do just some things:

  • Create some sort of front controller that constructs AppKernel using new AppKernel('frontend', false);
  • As AppKernel::registerContainerConfiguration() in the Symfony Standard Edition uses the environment to determine the config file to load, you have to create app/config/config_frontend.yml as well (or change the logic in the AppKernel method)
  • Inside this config file, make sure you import the settings that are in common. This often means importing app/config/config.yml. Besides that, you can configure things how you like it. E.g.

    # app/config/config_frontend.yml
    imports:
        - { resource: config.yml }
    
    twig:
        cache: false
    

You can read more about this topic in the Symfony docs.