alexeyplodenko/sitecode

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

Installs: 5

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 0

Forks: 0

Open Issues: 0

pkg:composer/alexeyplodenko/sitecode

v1.0.1 2026-01-18 21:46 UTC

This package is auto-updated.

Last update: 2026-01-29 11:32:34 UTC


README

Filament v4 and v5 basic CMS like plugin. Adds pages management with page structure defined in .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. Run composer require alexeyplodenko/sitecode.
  2. 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
  3. 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,
    ],
  4. 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
        }
    }
  5. Run php artisan sitecode:install to install cache feature.
  6. Run php artisan migrate to create DB tables to store data.

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>
</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

Special cases

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.