PHP code example of alphasoft-fr / messenger-filesystem-transport

1. Go to this page and download the library: Download alphasoft-fr/messenger-filesystem-transport 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/ */

    

alphasoft-fr / messenger-filesystem-transport example snippets


// config/bundles.php

return [
    // ...
    \AlphaSoft\Messenger\FilesystemTransport\AsMessengerFilesystemTransportBundle::class => ['all' => true],
];

use Symfony\Component\Messenger\MessageBusInterface;

class NotificationService
{
    private $bus;

    public function __construct(MessageBusInterface $bus)
    {
        $this->bus = $bus;
    }

    public function sendNotification(NotificationMessage $message): void
    {
        $this->bus->dispatch($message);
    }
}

// config/bundles.php

return [
    // ...
    \AlphaSoft\Messenger\FilesystemTransport\AsMessengerFilesystemTransportBundle::class => ['all' => true],
];

use Symfony\Component\Messenger\MessageBusInterface;

class NotificationService
{
    private $bus;

    public function __construct(MessageBusInterface $bus)
    {
        $this->bus = $bus;
    }

    public function sendNotification(NotificationMessage $message): void
    {
        $this->bus->dispatch($message);
    }
}