PHP code example of trollbus / message

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

    

trollbus / message example snippets


use Trollbus\Message\Message;

/**
 * @implements Message<void>
 */
final readonly class RegisterUser implements Message
{
    public function __construct(
        public string $username,
        #[\SensitiveParameter]
        public string $password,
    ) {}
}

use Trollbus\Message\Event;

final readonly class UserWasRegister implements Event
{
    public function __construct(
        public string $username,
    ) {}
}