Skip to content

Plugins

Phillip Dornauer edited this page Apr 19, 2026 · 1 revision

Plugins

Marble supports installable plugins. Plugins are standard Laravel packages that hook into the admin panel via the MarbleAdmin facade — no core files need to be modified.

Installing a Plugin

composer require vendor/package-name
php artisan vendor:publish --tag=plugin-assets  # if the plugin has assets

Laravel auto-discovery registers the plugin's ServiceProvider automatically (requires extra.laravel.providers in the plugin's composer.json).

Plugin Registry

The System → Plugins page searches Packagist for packages with "type": "marble-plugin" and enriches results with the marblecms/plugins registry, which marks packages as verified and featured.


Building a Plugin

composer.json

{
    "name": "vendor/my-marble-plugin",
    "type": "marble-plugin",
    "require": {
        "marble/admin": "^1.0"
    },
    "extra": {
        "laravel": {
            "providers": [
                "Vendor\\MyPlugin\\MyPluginServiceProvider"
            ]
        }
    }
}

The "type": "marble-plugin" makes the package discoverable in the Marble admin plugin search.

ServiceProvider

All plugin integration happens from the boot() method of your ServiceProvider:

use Marble\Admin\Facades\MarbleAdmin;

class MyPluginServiceProvider extends ServiceProvider
{
    public function boot(): void
    {
        // Add an item to an existing admin dropdown
        MarbleAdmin::addNavItem('content', 'My Section', 'myplugin.index', 'plugin', ['myplugin.*']);

        // Add a new top-level nav dropdown
        MarbleAdmin::addTopNavSection('myplugin', [
            'label'    => 'My Plugin',
            'icon'     => 'plugin',
            'patterns' => ['myplugin.*'],
            'items'    => [
                ['label' => 'Overview', 'route' => 'myplugin.index',  'icon' => 'chart_bar'],
                ['label' => 'Settings', 'route' => 'myplugin.config', 'icon' => 'wrench'],
            ],
        ]);

        // Inject CSS/JS into every admin page
        MarbleAdmin::addAsset('css', asset('vendor/myplugin/plugin.css'));
        MarbleAdmin::addAsset('js',  asset('vendor/myplugin/plugin.js'));

        // Register a CKEditor 4 external plugin
        MarbleAdmin::addCkEditorPlugin(
            'myplugin',
            asset('vendor/myplugin/ckeditor/'),
            ['MyButton'],
            'marble'
        );
    }
}

MarbleAdmin Facade Reference

use Marble\Admin\Facades\MarbleAdmin;

addNavItem(string $section, string $label, string $route, string $icon, array $activePatterns)

Adds an item to one of the core admin nav dropdowns.

Parameter Description
$section 'content', 'structure', 'users', or 'system'
$label Display text
$route Named Laravel route
$icon Famicon name (without .svg)
$activePatterns Route name patterns that highlight this section. Defaults to ['{route}*']
MarbleAdmin::addNavItem('content', 'Orders', 'marble.shop.orders', 'cart', ['marble.shop.*']);

addTopNavSection(string $key, array $config)

Registers a new top-level nav dropdown rendered after the System menu.

MarbleAdmin::addTopNavSection('shop', [
    'label'    => 'Shop',
    'icon'     => 'cart',
    'patterns' => ['marble.shop.*'],
    'items'    => [
        ['label' => 'Overview', 'route' => 'marble.shop.index',  'icon' => 'chart_bar'],
        ['label' => 'Orders',   'route' => 'marble.shop.orders', 'icon' => 'cart'],
    ],
]);

addAsset(string $type, string $url)

Injects a CSS or JS file into every admin page.

Parameter Values
$type 'css' or 'js'
$url Fully-qualified public URL (asset() helper recommended)

CSS is injected after the admin theme stylesheet. JS is injected after the core scripts.


addCkEditorPlugin(string $name, string $url, array $buttons, string $group)

Registers a CKEditor 4 external plugin.

Parameter Description
$name Matches the name passed to CKEDITOR.plugins.add()
$url URL to the directory containing plugin.js (must end with /)
$buttons Button names to add to the toolbar
$group Toolbar group to append buttons to (default: 'marble')
MarbleAdmin::addCkEditorPlugin(
    'marbleai',
    asset('vendor/marble-ai/ckeditor/'),
    ['MarbleAiButton'],
    'marble'
);

Available Plugins

Plugin Description
marblecms/marble-ecommerce Products, orders, discount codes, Stripe Checkout

Browse all verified plugins in System → Plugins inside the admin panel.

Clone this wiki locally