Skip to main content
Addons are the recommended way to package Shopper extensions. An addon is a self-contained unit that registers its routes, Livewire components, sidebar entries, views, and settings items through the ShopperPanel at boot time. When an addon is disabled, none of its assets are registered.

Creating an Addon

An addon is a class that extends Shopper\Addon\BaseAddon and implements Shopper\Contracts\ShopperAddon. The contract requires four methods: A minimal addon looks like this:

Registering an Addon

Register the addon in your application’s service provider using the Shopper facade:
The AddonManager checks isEnabled() before registering. If the addon is disabled via config, register() is never called and nothing is loaded.

What an Addon Can Register

Routes

Livewire Components

Pass a sidebar class that implements Shopper’s sidebar extension interface:

Blade Views

Register a view namespace so your Blade views are accessible as analytics::dashboard:

Settings Items

Add entries to the Settings page. Each entry is a class-string mapped to a boolean controlling its visibility:

Permissions

Declare additional permissions your addon introduces. They will be seeded alongside Shopper’s built-in permissions:

Styles and Scripts

Inject additional CSS or JS assets into the admin panel’s layout:

Disabling an Addon

Set the addon’s ID to false in config/shopper/addons.php:
When set to false, BaseAddon::isEnabled() returns false and the addon’s register() method is never called. Routes, components, sidebar entries, and assets are not loaded.

Checking if an Addon is Active

Full Example: A Loyalty Points Addon

Here is a complete addon that adds a loyalty points feature to the Shopper admin:
Register it once in your service provider: