Extending / Bundled Extensions / File Location & Layout
Note: You are currently reading the documentation for Bolt 3.3. Looking for the documentation for Bolt 4.0 instead?
Bundles should be thought of as part of your site project's code, and as such their location relative to your site's root directory is flexible.
The choice of location should be considered carefully, and according to both your project and Bundle's design requirements.
As Bundles are just a part of your site project's code, their location is relative to your site's root directory is flexible. Below are the recommended locations for specific file types.
As opposed to extensions installed via the Marketplace, a Bundle's PHP code can
theoretically live anywhere. However, it is strongly recommended that you put
your Bundle's PHP code either in the site root
src/ directory for a site with
a single Bundle, alternatively sites with multiple Bundles are best off
following a strategy such as
Note: Using a directory structure deeper than two levels for the location of the loader class is possible, but not supported.
Bundle configuration files are always located in the
directory, and are named after the lower case derived names of the Bundle
loader class and base namespace.
For example, if your loader class' fully qualified class name of
the Bundle name would be
Bravo and the author name would be
the configuration file must be named
Twig template files¶
As with PHP files, technically Twig template files can live anywhere under the
site's root. However for consistency and ease it is recommended to place them
either in your theme's directory or for Bundles installed under the site root
src/ directory, the
templates/ directory is also a supported option.
Bundles make no special decisions around web assets, just add them to your web root, or a subdirectory of your web root, and use relative paths.