telephantast/telephantast-bundle

Telephantast Symfony Bundle

0.1.x-dev 2024-10-18 00:30 UTC

This package is auto-updated.

Last update: 2024-12-18 00:51:02 UTC


README

Installation

composer require telephantast/telephantast-bundle '^0.1@dev'

If you use Symfony Flex, the bundle will be automatically registered in bundles.php. Otherwise, do it manually:

return [
    // ...
+   Telephantast\TelephantastBundle\TelephantastBundle::class => ['all' => true],
];

Configuration

See the full config by running:

bin/console debug:config telephantast

Configuration for bunny-transport and doctrine-persistence:

use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
use Telephantast\DoctrinePersistence\DoctrineOrmEntityFinderAndSaver;
use Telephantast\DoctrinePersistence\DoctrineOrmTransactionProvider;
use Telephantast\DoctrinePersistence\DoctrinePostgresOutboxStorage;

return static function (ContainerConfigurator $di): void {
    $di->extension('telephantast', [
        'entity_finder_id' => DoctrineOrmEntityFinderAndSaver::class,
        'entity_saver_id' => DoctrineOrmEntityFinderAndSaver::class,
        'async' => [
            'bunny' => [
                'host' => '%env(string:key:host:url:TELEPHANTAST_TRANSPORT_URL)%',
                'port' => '%env(int:key:port:url:TELEPHANTAST_TRANSPORT_URL)%',
                'user' => '%env(string:key:user:url:TELEPHANTAST_TRANSPORT_URL)%',
                'password' => '%env(string:key:pass:url:TELEPHANTAST_TRANSPORT_URL)%',
                'vhost' => '%env(string:key:path:url:TELEPHANTAST_TRANSPORT_URL)%',
                'heartbeat' => '%env(int:key:heartbeat:query_string:TELEPHANTAST_TRANSPORT_URL)%',
            ],
            'outbox' => [
                'transaction_provider_id' => DoctrineOrmTransactionProvider::class,
                'storage_id' => DoctrinePostgresOutboxStorage::class,
            ],
        ],
        'entities' => [
            MyEntity::class => null,
        ],
    ]);

    $di->services()
        ->defaults()
            ->autowire()
            ->autoconfigure()
        ->set(DoctrineOrmTransactionProvider::class)
        ->set(DoctrinePostgresOutboxStorage::class)
        ->set(DoctrineOrmEntityFinderAndSaver::class);
};
TELEPHANTAST_TRANSPORT_URL=bunny://guest:guest@rabbitmq:5672//?heartbeat=60