PHP code example of hassanelzarkawy / nactu

1. Go to this page and download the library: Download hassanelzarkawy/nactu 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/ */

    

hassanelzarkawy / nactu example snippets


use Nactu\CommandBusInterface;

public function store(CommandBusInterface $bus): void
{
    $bus->dispatch(new CreateUserCommand(
        name: 'Hassan',
        email: '[email protected]',
    ));
}

use Nactu\QueryBusInterface;

public function index(QueryBusInterface $bus): JsonResponse
{
    $users = $bus->dispatch(new ListUsersQuery(
        status: 'active',
    ));

    return response()->json($users);
}
bash
php artisan vendor:publish --tag=nactu-config
bash
php artisan make:command CreateUser
bash
php artisan make:query ListUsers