No description
Find a file
Snider 087d0ad557 refactor: update namespaces for L1 package convention
- Core\Mod\Tenant -> Core\Tenant
- Core\Mod\Agentic -> Core\Agentic

Part of namespace restructure to align with L1/L2 module conventions.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-27 17:34:38 +00:00
.claude/skills feat: add initial framework files including API, console, and web routes; set up testing structure 2026-01-26 14:25:55 +00:00
.github feat(api): add API versioning support with middleware for version parsing and sunset headers 2026-01-26 16:59:47 +00:00
changelog/2026/jan docs: add changelog entries for Jan 2026 2026-01-27 16:27:42 +00:00
config feat(components): add new Blade components for Flux UI including icons, charts, and form elements 2026-01-26 21:21:53 +00:00
docs fix(config): update ignore patterns for dead links and add coverage directory to .gitignore 2026-01-26 21:37:33 +00:00
src refactor: update namespaces for L1 package convention 2026-01-27 17:34:38 +00:00
stubs feat(components): add new Blade components for Flux UI including icons, charts, and form elements 2026-01-26 21:21:53 +00:00
tests refactor: update namespaces for L1 package convention 2026-01-27 17:34:38 +00:00
.gitignore fix(config): update ignore patterns for dead links and add coverage directory to .gitignore 2026-01-26 21:37:33 +00:00
CLAUDE.md Initial release: Core PHP modular monolith framework 2026-01-20 17:02:28 +00:00
composer.json feat(components): add new Blade components for Flux UI including icons, charts, and form elements 2026-01-26 21:21:53 +00:00
CONTRIBUTING.md feat(workspace): implement workspace teams and permissions management with enhanced member model 2026-01-26 19:00:50 +00:00
LICENSE Initial release: Core PHP modular monolith framework 2026-01-20 17:02:28 +00:00
package-lock.json feat(api): add API versioning support with middleware for version parsing and sunset headers 2026-01-26 16:59:47 +00:00
package.json feat(api): add API versioning support with middleware for version parsing and sunset headers 2026-01-26 16:59:47 +00:00
phpunit.xml feat(components): add new Blade components for Flux UI including icons, charts, and form elements 2026-01-26 21:21:53 +00:00
README.md feat(components): add new Blade components for Flux UI including icons, charts, and form elements 2026-01-26 21:21:53 +00:00
ROADMAP.md feat(workspace): implement workspace teams and permissions management with enhanced member model 2026-01-26 19:00:50 +00:00
SECURITY.md feat(workspace): implement workspace teams and permissions management with enhanced member model 2026-01-26 19:00:50 +00:00
TODO.md feat(components): add new Blade components for Flux UI including icons, charts, and form elements 2026-01-26 21:21:53 +00:00

Core PHP Framework

Tests Code Coverage 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 host-uk/core

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.