php-framework/packages/core-php
2026-01-26 19:00:50 +00:00
..
changelog/2026/jan refactor: update references from 'biolink' to 'page' and improve seeder structure 2026-01-26 14:24:25 +00:00
config refactor: update references from 'biolink' to 'page' and improve seeder structure 2026-01-26 14:24:25 +00:00
src feat(workspace): implement workspace teams and permissions management with enhanced member model 2026-01-26 19:00:50 +00:00
stubs Add core components and initial setup for the PHP framework 2026-01-21 14:11:45 +00:00
tests refactor: update references from 'biolink' to 'page' and improve seeder structure 2026-01-26 14:24:25 +00:00
composer.json feat(workspace): implement workspace teams and permissions management with enhanced member model 2026-01-26 19:00:50 +00:00
phpunit.xml refactor: update references from 'biolink' to 'page' and improve seeder structure 2026-01-26 14:24:25 +00:00
README.md feat(api): add API versioning support with middleware for version parsing and sunset headers 2026-01-26 16:59:47 +00:00
TODO.md feat(docs): update TODO list with completed documentation tasks and add new guides for service contracts, seeder system, and SQL security 2026-01-26 18:22:50 +00:00

Core PHP Framework

The core framework package providing event-driven architecture, module system, and foundational features for building modular Laravel applications.

Installation

composer require host-uk/core

Key Features

Event-Driven Module System

Modules declare lifecycle events they're interested in and are only loaded when needed:

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

Multi-Tenant Data Isolation

Automatic workspace scoping for Eloquent models:

use Core\Mod\Tenant\Concerns\BelongsToWorkspace;

class Product extends Model
{
    use BelongsToWorkspace;
}

// Automatically scoped to current workspace
$products = Product::all();

Actions Pattern

Single-purpose business logic classes with dependency injection:

use Core\Actions\Action;

class CreateOrder
{
    use Action;

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

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

Activity Logging

Built-in audit trails for model changes:

use Core\Activity\Concerns\LogsActivity;

class Order extends Model
{
    use LogsActivity;

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

Seeder Auto-Discovery

Automatic seeder ordering via attributes:

#[SeederPriority(10)]
#[SeederAfter(FeatureSeeder::class)]
class PackageSeeder extends Seeder
{
    public function run(): void
    {
        // ...
    }
}

HLCRF Layout System

Data-driven composable layouts:

use Core\Front\Components\Layout;

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

Lifecycle Events

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

Configuration

Publish the configuration:

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

Configure in config/core.php:

return [
    'module_paths' => [
        app_path('Core'),
        app_path('Mod'),
    ],
    'workspace_cache' => [
        'enabled' => true,
        'ttl' => 3600,
    ],
];

Artisan Commands

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

Requirements

  • PHP 8.2+
  • Laravel 11+ or 12+

Documentation

Changelog

See changelog/2026/jan/features.md for recent changes.

License

EUPL-1.2 - See LICENSE for details.