Edit on GitHub
Jump to docs navigation

Extending / Bundled Extensions / Building Bundles

Note: You are currently reading the documentation for Bolt 3.7. Looking for the documentation for Bolt 5.2 instead?

Bundle namespace

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\SimpleExtension and your class loader will have immediate access to a "quick build" loader class
  • Lightweight — Extend \Bolt\Extension\AbstractExtension for an implementation of the ExtensionInterface
  • Full control — Build your own complete implementation of \Bolt\Extension\ExtensionInterface

Note: The Bundle's loader class name, minus any "Extension" suffix, internally serves as the Bundle name.

With a few minor exceptions, the Basics, Intermediate, and Advanced sections on writing extensions are a good reference point.

Autoloader configuration

Loading of PHP classes is handled via PHP's autoloader and managed by Composer. For more information see the section on Autoloading.

Activation configuration

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

Edit this page on GitHub
Couldn't find what you were looking for? We are happy to help you in the forum, on Slack or on Github.