No description
Find a file
Snider 303186323a
Some checks failed
CI / PHP 8.3 (push) Failing after 2m3s
CI / PHP 8.4 (push) Failing after 2m21s
fix(scheduler): pre-filter files for #[Scheduled] before class_exists
class_exists() can trigger uncatchable E_COMPILE_ERROR when autoloading
classes with method signature mismatches (e.g. Activity model vs updated
Spatie parent). Now checks file contents for '#[Scheduled' string before
attempting to load — avoids autoloading hundreds of unrelated classes.

Also fixes Activity::getChangesAttribute() return type to match the
updated Spatie parent (Collection instead of array).

Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-12 15:58:15 +00:00
.claude/skills feat: replace Go CLI with PHP framework 2026-03-06 08:49:51 +00:00
.claude-plugin feat: add claude plugin for PHP/Laravel development 2026-03-09 18:15:42 +00:00
.core feat: merge go-php Go CLI into core/php 2026-03-06 17:50:01 +00:00
.forgejo/workflows feat: replace Go CLI with PHP framework 2026-03-06 08:49:51 +00:00
.github feat: replace Go CLI with PHP framework 2026-03-06 08:49:51 +00:00
bin feat: promote PHP commands to root in core-php binary 2026-03-09 18:47:55 +00:00
changelog/2026/jan feat: replace Go CLI with PHP framework 2026-03-06 08:49:51 +00:00
cmd/core-php feat: promote PHP commands to root in core-php binary 2026-03-09 18:47:55 +00:00
config feat: replace Go CLI with PHP framework 2026-03-06 08:49:51 +00:00
database/migrations feat(webhook): add WebhookCall model, migration, event, verifier interface 2026-03-12 14:21:20 +00:00
docker feat: replace Go CLI with PHP framework 2026-03-06 08:49:51 +00:00
docs docs: add human-friendly documentation 2026-03-11 13:02:41 +00:00
locales feat: merge go-php Go CLI into core/php 2026-03-06 17:50:01 +00:00
src fix(scheduler): pre-filter files for #[Scheduled] before class_exists 2026-03-12 15:58:15 +00:00
stubs feat: replace Go CLI with PHP framework 2026-03-06 08:49:51 +00:00
tests fix(scheduler): skip test directories in ScheduledActionScanner 2026-03-12 15:45:45 +00:00
.gitattributes feat: rename package to lthn/php for Packagist distribution 2026-03-09 17:56:14 +00:00
.gitignore chore: add .worktrees/ to .gitignore 2026-03-12 12:21:31 +00:00
bridge.go feat: merge go-php Go CLI into core/php 2026-03-06 17:50:01 +00:00
CLAUDE.md feat: replace Go CLI with PHP framework 2026-03-06 08:49:51 +00:00
cmd.go feat: promote PHP commands to root in core-php binary 2026-03-09 18:47:55 +00:00
cmd_build.go feat: merge go-php Go CLI into core/php 2026-03-06 17:50:01 +00:00
cmd_ci.go feat: merge go-php Go CLI into core/php 2026-03-06 17:50:01 +00:00
cmd_commands.go feat: merge go-php Go CLI into core/php 2026-03-06 17:50:01 +00:00
cmd_deploy.go feat: merge go-php Go CLI into core/php 2026-03-06 17:50:01 +00:00
cmd_dev.go feat: merge go-php Go CLI into core/php 2026-03-06 17:50:01 +00:00
cmd_packages.go feat: merge go-php Go CLI into core/php 2026-03-06 17:50:01 +00:00
cmd_serve_frankenphp.go feat: merge go-php Go CLI into core/php 2026-03-06 17:50:01 +00:00
composer.json feat: rename package to lthn/php for Packagist distribution 2026-03-09 17:56:14 +00:00
container.go feat: merge go-php Go CLI into core/php 2026-03-06 17:50:01 +00:00
container_test.go feat: merge go-php Go CLI into core/php 2026-03-06 17:50:01 +00:00
CONTRIBUTING.md feat: replace Go CLI with PHP framework 2026-03-06 08:49:51 +00:00
coolify.go feat: merge go-php Go CLI into core/php 2026-03-06 17:50:01 +00:00
coolify_test.go feat: merge go-php Go CLI into core/php 2026-03-06 17:50:01 +00:00
deploy.go feat: merge go-php Go CLI into core/php 2026-03-06 17:50:01 +00:00
deploy_internal_test.go feat: merge go-php Go CLI into core/php 2026-03-06 17:50:01 +00:00
deploy_test.go feat: merge go-php Go CLI into core/php 2026-03-06 17:50:01 +00:00
detect.go feat: merge go-php Go CLI into core/php 2026-03-06 17:50:01 +00:00
detect_test.go feat: merge go-php Go CLI into core/php 2026-03-06 17:50:01 +00:00
dockerfile.go feat: merge go-php Go CLI into core/php 2026-03-06 17:50:01 +00:00
dockerfile_test.go feat: merge go-php Go CLI into core/php 2026-03-06 17:50:01 +00:00
env.go feat: merge go-php Go CLI into core/php 2026-03-06 17:50:01 +00:00
extract.go feat: merge go-php Go CLI into core/php 2026-03-06 17:50:01 +00:00
go.mod feat: merge go-php Go CLI into core/php 2026-03-06 17:50:01 +00:00
go.sum feat: merge go-php Go CLI into core/php 2026-03-06 17:50:01 +00:00
handler.go feat: merge go-php Go CLI into core/php 2026-03-06 17:50:01 +00:00
i18n.go feat: merge go-php Go CLI into core/php 2026-03-06 17:50:01 +00:00
infection.json5 feat: replace Go CLI with PHP framework 2026-03-06 08:49:51 +00:00
LICENSE feat: replace Go CLI with PHP framework 2026-03-06 08:49:51 +00:00
package-lock.json feat: replace Go CLI with PHP framework 2026-03-06 08:49:51 +00:00
package.json feat: replace Go CLI with PHP framework 2026-03-06 08:49:51 +00:00
packages.go feat: merge go-php Go CLI into core/php 2026-03-06 17:50:01 +00:00
packages_test.go feat: merge go-php Go CLI into core/php 2026-03-06 17:50:01 +00:00
php-commands.yaml feat: replace Go CLI with PHP framework 2026-03-06 08:49:51 +00:00
php.go feat: merge go-php Go CLI into core/php 2026-03-06 17:50:01 +00:00
php_test.go feat: merge go-php Go CLI into core/php 2026-03-06 17:50:01 +00:00
phpstan.neon feat: replace Go CLI with PHP framework 2026-03-06 08:49:51 +00:00
phpunit.xml feat: replace Go CLI with PHP framework 2026-03-06 08:49:51 +00:00
psalm.xml feat: replace Go CLI with PHP framework 2026-03-06 08:49:51 +00:00
qa.yaml feat: replace Go CLI with PHP framework 2026-03-06 08:49:51 +00:00
quality.go feat: merge go-php Go CLI into core/php 2026-03-06 17:50:01 +00:00
README.md docs: update README badges and install command to lthn/php 2026-03-09 18:00:12 +00:00
rector.php feat: replace Go CLI with PHP framework 2026-03-06 08:49:51 +00:00
ROADMAP.md feat: replace Go CLI with PHP framework 2026-03-06 08:49:51 +00:00
security-checks.yaml feat: replace Go CLI with PHP framework 2026-03-06 08:49:51 +00:00
SECURITY.md feat: replace Go CLI with PHP framework 2026-03-06 08:49:51 +00:00
services.go feat: merge go-php Go CLI into core/php 2026-03-06 17:50:01 +00:00
services_extended_test.go feat: merge go-php Go CLI into core/php 2026-03-06 17:50:01 +00:00
services_test.go feat: merge go-php Go CLI into core/php 2026-03-06 17:50:01 +00:00
services_unix.go feat: merge go-php Go CLI into core/php 2026-03-06 17:50:01 +00:00
services_windows.go feat: merge go-php Go CLI into core/php 2026-03-06 17:50:01 +00:00
ssl.go feat: merge go-php Go CLI into core/php 2026-03-06 17:50:01 +00:00
ssl_extended_test.go feat: merge go-php Go CLI into core/php 2026-03-06 17:50:01 +00:00
ssl_test.go feat: merge go-php Go CLI into core/php 2026-03-06 17:50:01 +00:00
testing.go feat: merge go-php Go CLI into core/php 2026-03-06 17:50:01 +00:00
TODO.md feat: replace Go CLI with PHP framework 2026-03-06 08:49:51 +00:00
workspace.go feat: merge go-php Go CLI into core/php 2026-03-06 17:50:01 +00:00

Core PHP Framework

Latest Stable Version License PHP Version Laravel Version

A modular monolith framework for Laravel with event-driven architecture, lazy module loading, and built-in multi-tenancy.

Documentation

📚 Read the full documentation →

Features

  • Event-driven module system - Modules declare interest in lifecycle events and are only loaded when needed
  • Lazy loading - Web requests don't load admin modules, API requests don't load web modules
  • Multi-tenant isolation - Workspace-scoped data with automatic query filtering
  • Actions pattern - Single-purpose business logic classes with dependency injection
  • Activity logging - Built-in audit trails for model changes
  • Seeder auto-discovery - Automatic ordering via priority and dependency attributes
  • HLCRF Layout System - Hierarchical composable layouts (Header, Left, Content, Right, Footer)

Installation

composer require lthn/php

The service provider will be auto-discovered.

Quick Start

Creating a Module

php artisan make:mod Commerce

This creates a module at app/Mod/Commerce/ with a Boot.php entry point:

<?php

namespace Mod\Commerce;

use Core\Events\WebRoutesRegistering;
use Core\Events\AdminPanelBooting;

class Boot
{
    public static array $listens = [
        WebRoutesRegistering::class => 'onWebRoutes',
        AdminPanelBooting::class => 'onAdmin',
    ];

    public function onWebRoutes(WebRoutesRegistering $event): void
    {
        $event->views('commerce', __DIR__.'/Views');
        $event->routes(fn () => require __DIR__.'/Routes/web.php');
    }

    public function onAdmin(AdminPanelBooting $event): void
    {
        $event->routes(fn () => require __DIR__.'/Routes/admin.php');
    }
}

Lifecycle Events

Event Purpose
WebRoutesRegistering Public-facing web routes
AdminPanelBooting Admin panel routes and navigation
ApiRoutesRegistering REST API endpoints
ClientRoutesRegistering Authenticated client routes
ConsoleBooting Artisan commands
McpToolsRegistering MCP tool handlers
FrameworkBooted Late-stage initialisation

Core Patterns

Actions

Extract business logic into testable, reusable classes:

use Core\Actions\Action;

class CreateOrder
{
    use Action;

    public function handle(User $user, array $data): Order
    {
        // Business logic here
        return Order::create($data);
    }
}

// Usage
$order = CreateOrder::run($user, $validated);

Multi-Tenant Isolation

Automatic workspace scoping for models:

use Core\Mod\Tenant\Concerns\BelongsToWorkspace;

class Product extends Model
{
    use BelongsToWorkspace;
}

// Queries are automatically scoped to the current workspace
$products = Product::all();

// workspace_id is auto-assigned on create
$product = Product::create(['name' => 'Widget']);

Activity Logging

Track model changes with minimal setup:

use Core\Activity\Concerns\LogsActivity;

class Order extends Model
{
    use LogsActivity;

    protected array $activityLogAttributes = ['status', 'total'];
}

HLCRF Layout System

Data-driven layouts with infinite nesting:

use Core\Front\Components\Layout;

$page = Layout::make('HCF')
    ->h('<nav>Navigation</nav>')
    ->c('<article>Main content</article>')
    ->f('<footer>Footer</footer>');

echo $page;

Variant strings define structure: HCF (Header-Content-Footer), HLCRF (all five regions), H[LC]CF (nested layouts).

See HLCRF.md for full documentation.

Configuration

Publish the config file:

php artisan vendor:publish --tag=core-config

Configure module paths in config/core.php:

return [
    'module_paths' => [
        app_path('Core'),
        app_path('Mod'),
    ],
];

Artisan Commands

php artisan make:mod Commerce      # Create a module
php artisan make:website Marketing # Create a website module
php artisan make:plug Stripe       # Create a plugin

Module Structure

app/Mod/Commerce/
├── Boot.php           # Module entry point
├── Actions/           # Business logic
├── Models/            # Eloquent models
├── Routes/
│   ├── web.php
│   ├── admin.php
│   └── api.php
├── Views/
├── Migrations/
└── config.php

Documentation

Testing

composer test

Requirements

  • PHP 8.2+
  • Laravel 11+

License

EUPL-1.2 - See LICENSE for details.