Extending / Bundled Extensions / Building Bundles
Note: You are currently reading the documentation for Bolt 3.4. Looking for the documentation for Bolt 3.5 instead?
Bundles need to be defined inside their own base namespace. This namespace is important to decide on first, as it will influence the target directory location of your Bundle, and is needed for your autoloading, and activation configuration
Note: The last name in the namespace path internally serves as the "author" name.
Bundle files location & layout¶
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.
For more information see the section on Location & Layout of Bundles.
Bundle loader class design¶
Your first architectural decision is the type of extension loader class you are going to use to define and load your Bundle.
You can choose to write your class, in order of difficulty, as:
- Simplicity — Just extend
\Bolt\Extension\SimpleExtensionand your class loader will have immediate access to a "quick build" loader class
- Lightweight — Extend
\Bolt\Extension\AbstractExtensionfor an implementation of the
- Full control — Build your own complete implementation of
Note: The Bundle's loader class name, minus any "Extension" suffix, internally serves as the Bundle name.
Loading of PHP classes is handled via PHP's autoloader and managed by Composer. For more information see the section on Autoloading.
Once you have a bundled extension loaded in your application, the interface within the Bolt extensions screen has also been adjusted to separate bundled extensions from those installed via the Marketplace.
Your bundled extensions will now appear underneath the other installed extensions. For more information see the section on Activation