A few years back Symfony introduced glob patterns for importing and loading configuration files. You can see an example of this in the stock kernel class
protected function configureRoutes(RouteCollectionBuilder $routes): void
{
$confDir = $this->getProjectDir() . '/config';
$routes->import($confDir . '/{routes}/*' . self::CONFIG_EXTS, '/', 'glob');
$routes->import($confDir . '/{routes}/' . $this->environment . '/**/*' . self::CONFIG_EXTS, '/', 'glob');
$routes->import($confDir . '/{routes}' . self::CONFIG_EXTS, '/', 'glob');
}
Those glob patterns expand to look like this
$routes->import("/path/to/symfony/config/{routes}/*.{php,xml,yaml,yml}", ...
$routes->import("/path/to/symfony/config/{routes}/dev/**/*.{php,xml,yaml,yml}", ...
$routes->import("/path/to/symfony/config/{routes}.{php,xml,yaml,yml}", ...
This brings a few questions to mind. First off -- what is the **
pattern? That's not a standard part of PHP's glob syntax. I presume by context it means "everything in this folder and all sub-folders", but I can't find official docs on Symfony's glob syntax to know for sure.
Other things about the patterns are odd -- like {routes}
. Normally you put things in braces when you want to match a list -- but this uses braces with only one item in the list which makes me think I don't understand what's going on?
When I go spelunking in the source code the methods involved are big ones and not the most intuitive to follow.
Is Symfony's glob syntax an implementation of a standard glob syntax? Or is it its own thing, and if so, what extra features does it have beyond the standard wildcards? (regexes? more special things like **
? does a single word in a brace mean anything?)