MKSine: A Filament CMS with Plugins, Themes, and Blocks for Laravel
Composer Pacakge Filament #Laravel #Filament #CMS #Page Builder #Plugins #Open Source

MKSine: A Filament CMS with Plugins, Themes, and Blocks for Laravel

4 min read Mohamed Said Mohamed Said

What Is MKSine?

Most Laravel projects that need a public-facing marketing site end up hand-rolling a content layer on top of Filament. MKSine, by Miran Salehi, fills that gap. It ships pages, posts, categories, a block-based page builder, themes, menus, a media library, and a plugin system — all wired into a Filament 4/5 admin panel.

Installation and Bootstrap

Install the package and scaffold a Filament panel:

composer require miran/mksine
php artisan filament:install --panels

Before running the installer, make two manual edits:

  1. Register MksinePlugin::make() on your panel in AdminPanelProvider and remove the default ->pages([Dashboard::class]) line — running both causes a 500 error.
  2. Remove the default Route::get('/') handler in routes/web.php — MKSine serves the homepage through the active theme.

Then run:

php artisan mksine:install --migrate
php artisan mksine:create-super-admin

mksine:install publishes config, runs migrations, and calls shield:generate --all. If MksinePlugin is not registered on the panel at that moment, no MKSine permissions are created. Fix it afterwards with php artisan shield:generate --panel=admin --all.

Authorisation is handled by Filament Shield. The installer also patches app/Models/User.php to add the FilamentUser contract and the InteractsWithMksine trait, writing a timestamped backup first.

Plugin System

A MKSine plugin lives under plugins/{id}/ with a plugin.php manifest and a class implementing PluginInterface. Generator commands handle the scaffolding:

php artisan mks-plugin:make notes --author="Your Name"
php artisan mks-plugin:discover
php artisan mks-plugin:install notes
php artisan mks-plugin:activate notes

Discovery caches the registry at bootstrap/cache/mks_plugins_discovery.php. Plugin state (discovered, installed, active, inactive, failed) is tracked in the mks_plugins table. If a plugin's boot() throws, a boot guard marks it failed and logs the message to mks_plugins.boot_error without taking down the rest of the app. Deactivating hides admin screens but leaves data intact; --delete-data is required to remove it.

Hooks

MKSine provides two extension families:

  • Discovery hooks — listener classes scanned by php artisan mks:discover, stored in mks_hooks, and togglable from the admin panel.
  • Runtime hooks — closures or class callbacks registered via the Hooks:: facade inside a plugin's boot(). These stay in memory and are not visible in the admin.

Only FormHookManager catches listener exceptions; table, resource, and page hooks let exceptions propagate. Listeners can implement QueueableHookEventInterface to queue heavy work.

Page Builder Blocks

Blocks extend BaseBuilderComponent and define a Filament schema for editing and a Blade view for rendering. There is no auto-discovery — register each block manually:

use Miran\Mksine\Core\PageBuilder\ComponentRegistry;

app(ComponentRegistry::class)->register(PriceTableBlock::class);

The page tree is stored in a builder_payload JSON column. Views receive a $data array and a $children array for container blocks. When a block type is missing or its view no longer exists, the renderer falls back to a yellow "Unknown component type" panel rather than throwing.

Themes, Menus, and Media

  • Themes — a directory under themes/{id}/ or a Composer package; one is active at a time and supplies all storefront Blade views.
  • Menus — nested, drag-to-reorder, supporting pages, posts, categories, and custom URLs assigned to theme locations.
  • Media library — a custom single-disk store (not Spatie Media Library) with a MediaPicker component and automatic small/medium/large thumbnails. Image optimisation requires binaries such as jpegoptim on the server.

Settings and Admin Console

Plugins add settings tabs through SettingsTabManager rather than editing the settings page class. Every field is saved to the settings table by field name — prefix plugin field names to avoid overwriting core settings like site_name.

A super-admin-only console page runs an allowed set of Artisan and Composer commands with live output.

Key Takeaways

  • Requires PHP 8.2, Laravel 11, and Filament 4 or 5 (Filament 5 needs Laravel 11.28+, Livewire 4, Tailwind 4).
  • Plugin boot failures are isolated — one broken plugin does not crash the app.
  • Blocks have no per-block Shield permission; guard sensitive rendered output yourself.
  • Settings are saved immediately with no draft or audit trail.
  • Current release is v1.5.1 — review the source before deploying to production.
  • MIT licensed, community-maintained (not an official Filament project).

Read the original article on Laravel News

Found this useful?

Frequently Asked Questions

3 questions
Q01 Does MKSine work with Filament 5?
Yes. MKSine targets both Filament 4 and Filament 5. Filament 5 support requires Laravel 11.28 or higher, Livewire 4, and Tailwind 4.
Q02 What happens if a MKSine plugin throws an exception during boot?
A boot guard catches the exception, marks the plugin as failed in the mks_plugins table, and writes the error message to the boot_error column. The rest of the application continues running normally.
Q03 How do I add a custom page builder block in MKSine?
Extend BaseBuilderComponent, implement getType(), getSchema(), and getRenderView(), then register the class with the ComponentRegistry — typically from your plugin's boot() method. There is no auto-discovery.

Continue reading

More Articles

View all