PHP code example of solidframe / laravel

1. Go to this page and download the library: Download solidframe/laravel library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

solidframe / laravel example snippets


// app/Application/Handler/PlaceOrderHandler.php
final readonly class PlaceOrderHandler implements CommandHandler
{
    public function __invoke(PlaceOrder $command): void { /* ... */ }
}

// That's it. No registration needed.
$commandBus->dispatch(new PlaceOrder('order-123', 'customer-456'));

// config/solidframe.php
return [
    'discovery' => [
        'enabled' => true,
        'paths' => ['app'],
    ],
    'cqrs' => [
        'command_bus' => ['middleware' => []],
        'query_bus' => ['middleware' => []],
    ],
    'event_driven' => [
        'event_bus' => ['middleware' => []],
    ],
    'event_sourcing' => [
        'event_store' => [
            'driver' => 'database',
            'connection' => null,
            'table' => 'event_store',
        ],
        'snapshot_store' => [
            'driver' => 'database',
            'connection' => null,
            'table' => 'snapshots',
        ],
    ],
    'saga' => [
        'store' => [
            'driver' => 'database',
            'connection' => null,
            'table' => 'sagas',
        ],
    ],
    'modular' => [
        'path' => 'modules',
        'auto_discovery' => true,
    ],
];

use SolidFrame\Laravel\Modular\ModuleServiceProvider;

final class InventoryServiceProvider extends ModuleServiceProvider
{
    protected function module(): ModuleInterface
    {
        return new InventoryModule();
    }

    public function register(): void
    {
        parent::register();
        // custom bindings...
    }
}

// config/solidframe.php
'cqrs' => [
    'command_bus' => [
        'middleware' => [
            App\Middleware\TransactionMiddleware::class,
            App\Middleware\LoggingMiddleware::class,
        ],
    ],
],
bash
php artisan vendor:publish --tag=solidframe-config
bash
php artisan vendor:publish --tag=solidframe-migrations
bash
php artisan make:module Inventory

modules/
└── Inventory/
    ├── InventoryModule.php
    ├── InventoryServiceProvider.php
    └── Database/
        └── Migrations/