alexeyplodenko/sitecode

Filament v4 basic CMS like plugin. Adds pages management with page structure defined in .php files.

Installs: 9

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 0

Forks: 0

Open Issues: 0

pkg:composer/alexeyplodenko/sitecode

v1.0.3 2026-02-15 15:02 UTC

This package is auto-updated.

Last update: 2026-02-15 15:02:41 UTC


README

Are you a developer in need to manage website page texts and images? This Filament plugin does exactly that.

You create a Laravel Blade page template. Specify the editable content with PHP code. Create the page through the Filament admin with the created Blade template and voilĂ ! Your page is live and editable.

Check the example in Usage

Filament plugin

Filament v4 and v5 basic CMS like plugin. This plugin adds page management with page structure defined in .admin.php files.

This plugin allows to:

  • Create, edit and disable pages;
  • Assign pages to routes;
  • Edit page text, images and videos.

Provides a robust cache. That caches the whole page completely and serves it using only the web server, without triggering any PHP processing. That reduces the page load times significantly and is crucial for those sweet Lighthouse SEO optimized green metrics. With this cache enabled, your web server would send your page within 10ms.

Installation

  1. Install Laravel https://laravel.com/docs/12.x/installation
  2. Install Filament with panels https://filamentphp.com/docs/5.x/introduction/installation
  3. Run composer require alexeyplodenko/sitecode.
  4. Create the following directories and give PHP write and web server read permissions:
    1. /public/media/ for image and file uploads
    2. /public/sitecode_static_cache/ for pages cache
  5. Create a public disk, if you need to edit images and files in Sitecode. Go to /config/filesystems.php, add the following to the 'disks' array:
    'sitecode_public_media' => [
        'driver' => 'local',
        'root' => public_path('media'),
        'url' => env('APP_URL').'/media',
        'visibility' => 'public',
        'throw' => true,
        'report' => true,
    ],
  6. Register the plugin in Filament AdminPanelProvider /app/Providers/Filament/AdminPanelProvider.php:
    <?php
    
    namespace App\Providers\Filament;
    
    use Filament\Panel;
    use Filament\PanelProvider;
    
    class AdminPanelProvider extends PanelProvider
    {
        public function panel(Panel $panel): Panel
        {
            return $panel
                // ...
                ->plugin(\Alexeyplodenko\Sitecode\SitecodePlugin::make()); // <-- Add this line
        }
    }
  7. Delete the contents of the /routes/web.php file.
  8. Run php artisan sitecode:install to install cache feature.
  9. Run php artisan migrate to create DB tables to store data.
  10. Run npm i to install JS libraries.
  11. Run npm run dev to build your CSS and JS assets on the fly. Or npm run build to create them for production.
  12. Once you have created a Filament user php artisan make:filament-user and started your web server, you can access the Admin panel via http://localhost/admin/

Usage

For example, we have the following Blade file /resources/views/home.blade.php:

<!DOCTYPE html>
<html lang="en">
<head>
    <title>My Website</title>
</head>
<body>
<main>
    <h1>My page title</h1>
    <p>My page content goes here...</p>
    <div>
        <img src="/my-image.jpg" alt="">
    </div>
</main>
</body>
</html>

To make the content editable with Sitecode, create a file /resources/views/home.admin.php next to original text.blade.php file, with:

<?php
$pageFields = new \Alexeyplodenko\Sitecode\Models\PageFields();

$pageFields->makeField('Title');
$pageFields->makeField('Text')->setEditorWysiwyg();
$pageFields->makeField('Image')->setEditorFile();

return $pageFields;

and then adjust the initial Blade file /resources/views/home.blade.php:

@php /** @var \Alexeyplodenko\Sitecode\Models\Page $page */ @endphp
<!DOCTYPE html>
<html lang="en">
<head>
    <title>{{ $page->title }}</title>{{-- $page->title comes from the page properties --}}
</head>
<body>
<main>
    @if ($page->hasContent('Title'))
        <h1>{{ $page->getContent('Title') }}</h1>
    @endif
    {!! $page->getContent('Text') !!}
    <div>
        <img src="{{ $page->getContent('Image') }}" alt="">
    </div>
</main>
</body>
</html>

Now go to Filament installation in your browser (by default at http://localhost/admin), and add your fist page in Pages. You want to create a page with our created home.blade.php view created before.

Here is the website page and its content:

Website page and content edit

Here are the page properties:

Page properties

The list of pages:

List of pages

Views/Templates

Sitecode automatically recursively loads all .blade.php files from your project's /resources/views/ directory.

You can manually specify the list of views/templates to use with a user-friendly name, by publishing the Sitecode configuration file and listing the views your want to show to the user in /config/sitecode.php views array:

<?php

return [
    // ...
    'views' => [
        'about-us.blade.php' => 'About us',
        'category.blade.php' => 'Category',
        'home.blade.php' => 'Home',
    ]
];

Styling rich HTML content (coming from WYSIWYG)

When the rich HTML content is outputted to the page using {!! $page->getContent('Text') !!}, the HTML content is wrapped into a <span class="sitecode">YOU HTML GOES HERE</span> tag.

You can use the .sitecode class to style the outputted content.

Usual Laravel routes/controllers/views

You can continue to use usual Laravel routes, controllers and views as usual.

Just define your route in /routes/web.php, as you would usually do.

Usual Laravel controller, but a Sitecode managed content in view

Easy. Return sitecodeViewFromUrl() from your controller's action.

For example, create a page at /events inside Sitecode panel, and then adjust your /routes/web.php file:

Route::get('/events', function() {
    $events = [
        ['name' => 'An Event', 'date' => '2026-02-10', 'time' => '12:00']
   ];

    return sitecodeViewFromUrl('/event', ['event' => $event]);
});

The $events variable will be accessible in your Blade view, chosen for the /events endpoints in the Sitecode panel.

A page with shared content, but no entry in Sitecode panel

Do you need to show a page, but do not want to create a record in Sitecode admin panel. No worries.

Use the sitecodeViewFromBlade($view, $data) helper function. For example,

Route::get('/event/{slug}', function(string $slug) {
    $event = \App\Models\Event::query()->where('slug', $slug)->firstOrFail();
   
    return sitecodeViewFromBlade('event.blade.php', ['event' => $event]);
});

Special cases

Publishing Sitecode configuration file

To publish and make customizable the configuration file, run the following command php artisan vendor:publish --tag=sitecode.

Custom admin. panel domain

Define your custom admin. panel domain as SITECODE_ADMIN_URL=https://admin.example.com in /.env file, when the domain is different from your website domain.

Custom disk name

Define your custom filesystem disk name as SITECODE_DISK=sitecode_public_media in /.env file, if you do not want to use the default one.

Issues you might face

Disk [sitecode_public_media] does not have a configured driver.

You have missed the step 3 from the Installation section of this document.