magna-cms/plugin-sdk

The official SDK for building Magna CMS plugins — extension contracts, the plugin base class, and the manifest spec.

Maintainers

Package info

github.com/Magna-CMS/Magna-Plugin-SDK

pkg:composer/magna-cms/plugin-sdk

Transparency log

Statistics

Installs: 6

Dependents: 1

Suggesters: 0

Stars: 0

Open Issues: 0

v1.0.0 2026-07-12 17:36 UTC

This package is auto-updated.

Last update: 2026-07-12 17:48:42 UTC


README

The official SDK for building Magna CMS plugins.

It contains the stable, versioned public API a plugin compiles against — the extension contracts, the Plugin base class, and the magna.json manifest spec — so you can build a plugin in your own repository without depending on Magna's core.

Install

composer require magna-cms/plugin-sdk

Quick start

A plugin is a Composer package with "type": "magna-plugin", a magna.json manifest, and an entry class that extends Magna\Plugins\Plugin:

use Magna\Plugins\Plugin;
use Magna\Contracts\RegistersDashboardWidgets;

class HelloPlugin extends Plugin implements RegistersDashboardWidgets
{
    public function boot(): void
    {
        // load routes, views, listeners…
    }

    public function dashboardWidgets(): array
    {
        return [\Acme\Hello\Widgets\HelloWidget::class];
    }
}

magna.json:

{
    "name": "acme/hello",
    "displayName": "Hello",
    "description": "An example plugin.",
    "version": "1.0.0",
    "author": "Acme",
    "license": "MIT",
    "compat": { "magna": "^1.0", "php": "^8.3" },
    "entry": "Acme\\Hello\\HelloPlugin",
    "permissions": []
}

The manifest is validated against schema/magna.schema.json.

Extension contracts

Implement any of these interfaces on your entry class to hook into the CMS. The core calls the matching method at the right point in the lifecycle:

Contract Method Provides
RegistersAdminResources adminResources() Filament resources (CRUD screens)
RegistersAdminNavigation adminNavigation() A sidebar nav group
RegistersDashboardWidgets dashboardWidgets() Admin dashboard widgets
RegistersSettingsPages settingsPages() Pages under Settings
RegistersBlocks blockPaths() Block definitions
RegistersWebhookEvents webhookEvents() Custom webhook event keys
ExtendsEntryForm entryFormExtensions() Extra fields on a content type form
FiltersApiQuery filterApiQuery() Scope the delivery API query

Versioning

This package is semantically versioned. Everything exported here is a public contract: within a major version, existing signatures will not break. Your plugin declares which core it supports via compat.magna in magna.json.

License

MIT.