The Anatomy of an Addon


All addon types inherently support the same addon structure. This article will go over the shared structure of addons.


Throughout this article you will notice addons being references by their dot-namespace. The dot namespace is comprised of the addon vendor, type, and slug.



All addon types support a /resources directory. The resources directory is used to store config, language files, assets, images, or anything else that is not a class.


Addons register the /resources directory as an image path hint:

{% verbatim %}{{ img('pryocms.theme.accelerant::img/favicon.png') }}{% endverbatim %}


Addons register the /resources directory as an asset path hint:

{% verbatim %}{{ asset_add('styles.css', 'pryocms.theme.accelerant::scss/theme.scss') }}{% endverbatim %}


Addons register the /resources/views directory as a view path hint:

return view('anomaly.module.posts::posts/index');


Addons register the /resources/config directory with Laravel configuration:

return config('');


Addons register the /resources/lang directory with Laravel's translator:

return trans('');

Composer File

All addons support a composer.json file.


    "name": "anomaly/xml_feed_widget-extension",
    "type": "streams-addon",
    "description": "A dashboard widget that displays an XML feed.",
    "keywords": [
        "pyrocms addon",
        "dashboard widget",
    "homepage": "",
    "license": "MIT",
    "authors": [
            "name": "PyroCMS, Inc.",
            "email": "[email protected]",
            "homepage": "",
            "role": "Owner"
    "support": {
        "email": ""
    "require": {
        "simplepie/simplepie": "~1.4.0"
    "autoload": {
        "psr-4": {
            "Anomaly\\XmlFeedWidgetExtension\\": "src/"


The autoload section loads during runtime if not already in the autoloader. Typically this is used to simply load the addons src directory.


Required dependencies will be downloaded on composer install and composer update.

Heads Up! Addon dependencies require that the addon be included in the root composer.json file.

Addon Class

Every addon must include the addon class. Modules will a module class, themes will require a theme class, and so on.


These classes must extend the matching base addon class.

Service Provider

All addons also support an addon service provider. Addon service providers work essentially the same as other Laravel service providers, but with added features. Addon service providers are named after the addon class.


Addon service providers must extend the AddonServiceProvider class.


The /tests directory contains all of the addon's feature and unit tests. When running make:addon an example feature test is created for you. When running make:stream tests for every entity class are also generated for you. Feel free to delete any or all tests as desired.

To run tests on the addon simply navigate to the addon's root directory and run phpunit.


The \factories directory is automatically loaded into Laravel's eloquent factory manager.

When using the make:stream command a factory is automatically generated for you.