March 24, 2017 Javier Eguiluz

A few weeks ago, we published an article about importing files with glob patterns in Symfony 3.3. The response from the community was so enthusiastic that we decided to improve and generalize the support of glob patterns in the framework.

The previous feature allowed to use glob patterns only when importing files and it was restricted to the files used in the container, so you couldn't use it in routing files.

This new feature moves all the glob pattern logic to the Config component and adds a new GlobFileLoader class that actually loads files using glob patterns. Moreover, this new loader is registered for both the routing and container file loaders.

The following example, extracted from the Kernel class used in the soon-to-be-unveiled "Symfony Flex" project, shows this new glob file loader used inside a Symfony micro kernel: