January 1st, 2022  |  Victor Paredes

Statamic Addon Development Field Manual

The aim of this document is to collect foundational knowledge needed in order to build Statamic Addons. I was motivated to collect this information on my own after feeling frustrated by the lack of information geared toward non-expert developers. Because this is not intended to be exhaustive, I recommend using the information here in conjunction with the official Statamic and Laravel documentation. Throughout this article, I have done my best to link to as many relevant texts as possible.

The overall goal is to avoid spending hours digging through documentation! Hopefully this is a valuable resource for you as it has been for me. Happy developing!

Create Addon Scaffolding

Let's start from the very beginning. In your project folder, use ask Statamic's please command (an alias of Laravel command artisan statamic:) to generate a basic addon scaffolding:

php please make:addon organization/addon
The following scaffolding will be generated for you.
organization
addon
src
ServiceProvider.php
.gitignore
composer.json
README.md
Context: app/addons/

Additionally, your addon will be required in your project's composer.json file

"require": {
    "organization/addon": "@dev",
}

as well as symlinked, also in composer.json.

"repositories": [
    {
        "type": "path",
        "url": "addons/organization/addon"
    }
]

To check for success, visit the Addons section of your Control Panel. You should see your new Addon. It doesn't do anything yet, but it feels great to get started, doesn't it?

Add a Control Panel New Navigation Item

By the end of this section, we will have a new (empty) Navigation menu item in our control panel. This will give us a great foundation for communicating with users of our Addon. It looks like this:

We need to add several files and update one.
organization
addon
resources
views
dashboard.blade.php
routes
cp.php
src
ServiceProvider.php
.gitignore
composer.json
README.md
Context: app/addons/
Meet the Author
 

Victor Paredes is a web and print designer. When not hard at work, you can find him tinkering around with code, music, artwork, and archaic poetic structures. He is based in Portland, Oregon.
 
Close