PHPackages                             vanta/temporal-bundle - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. vanta/temporal-bundle

ActiveSymfony-bundle

vanta/temporal-bundle
=====================

Integration temporal with symfony

0.4.5(1y ago)7231.4k—5.5%11[2 issues](https://github.com/VantaFinance/temporal-bundle/issues)[2 PRs](https://github.com/VantaFinance/temporal-bundle/pulls)MITPHPPHP ^8.2CI passing

Since Sep 16Pushed 2mo agoCompare

[ Source](https://github.com/VantaFinance/temporal-bundle)[ Packagist](https://packagist.org/packages/vanta/temporal-bundle)[ RSS](/packages/vanta-temporal-bundle/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (18)Versions (29)Used By (0)

Temporal Bundle
===============

[](#temporal-bundle)

[Temporal](https://temporal.io/) is the simple, scalable open source way to write and run reliable cloud applications.

Features
--------

[](#features)

- **Sentry**: Send throwable events (if the [`SentryBundle`](https://github.com/getsentry/sentry-symfony) use)
- **Doctrine**: clear opened managers and check connection is still usable after each request ( if [`DoctrineBundle`](https://github.com/doctrine/DoctrineBundle) is use)
- **Serializer**: Deserialize and serialize messages (if [`Symfony/Serializer`](https://github.com/symfony/serializer)is use, **Recommend use**)

Requirements:
-------------

[](#requirements)

- php &gt;= 8.2
- symfony &gt;= 6.0

Installation:
-------------

[](#installation)

1. Connect recipes

```
composer config --json extra.symfony.endpoint '["https://raw.githubusercontent.com/VantaFinance/temporal-bundle/main/.recipie/index.json", "flex://defaults"]'
```

2. Install package

```
composer req temporal serializer
```

3. Configure docker-compose-temporal.yml/Dockerfile
4. Added Workflow/Activity. See [examples](https://github.com/temporalio/samples-php) to get started.

Doctrine integrations
---------------------

[](#doctrine-integrations)

If [`DoctrineBundle`](https://github.com/doctrine/DoctrineBundle) is use, the following finalizer is available to you:

- `temporal.doctrine_ping_connection_.finalizer`
- `temporal.doctrine_clear_entity_manager.finalizer`

And interceptors:

- `temporal.doctrine_ping_connection__activity_inbound.interceptor`

Example config:

```
temporal:
  defaultClient: default
  pool:
    dataConverter: temporal.data_converter
    roadrunnerRPC: '%env(RR_RPC)%'

  workers:
    default:
      taskQueue: default
      exceptionInterceptor: temporal.exception_interceptor
      finalizers:
        - temporal.doctrine_ping_connection_default.finalizer
        - temporal.doctrine_clear_entity_manager.finalizer
      interceptors:
        - temporal.doctrine_ping_connection_default_activity_inbound.interceptor

  clients:
    default:
      namespace: default
      address: '%env(TEMPORAL_ADDRESS)%'
      dataConverter: temporal.data_converter
    cloud:
      namespace: default
      address: '%env(TEMPORAL_ADDRESS)%'
      dataConverter: temporal.data_converter
      clientKey: '%env(TEMPORAL_CLIENT_KEY_PATH)%'
      clientPem: '%env(TEMPORAL_CLIENT_CERT_PATH)%'
```

Sentry integrations
-------------------

[](#sentry-integrations)

Install packages:

```
composer require sentry temporal-sentry
```

If [`SentryBundle`](https://github.com/getsentry/sentry-symfony) is use, the following interceptors is available to you:

- `temporal.sentry_workflow_outbound_calls.interceptor`
- `temporal.sentry_activity_inbound.interceptor`

Example config:

```
temporal:
  defaultClient: default
  pool:
    dataConverter: temporal.data_converter
    roadrunnerRPC: '%env(RR_RPC)%'

  workers:
    default:
      taskQueue: default
      exceptionInterceptor: temporal.exception_interceptor
      interceptors:
        - temporal.sentry_workflow_outbound_calls.intercepto
        - temporal.sentry_activity_inbound.interceptor

  clients:
    default:
      namespace: default
      address: '%env(TEMPORAL_ADDRESS)%'
      dataConverter: temporal.data_converter
```

Worker Factory
--------------

[](#worker-factory)

By default the `Temporal\WorkerFactory` is used to instantiate the workers. However when you are unit-testing you may wish to override the default factory with the one provided by the ['Testing framework'](https://github.com/temporalio/sdk-php/tree/master/testing)

Example Config:

```
temporal:
  defaultClient: default
  pool:
    dataConverter: temporal.data_converter
    roadrunnerRPC: '%env(RR_RPC)%'

  workers:
    default:
      taskQueue: default
      exceptionInterceptor: temporal.exception_interceptor
      interceptors:
        - temporal.sentry_workflow_outbound_calls.intercepto
        - temporal.sentry_activity_inbound.interceptor

  clients:
    default:
      namespace: default
      address: '%env(TEMPORAL_ADDRESS)%'
      dataConverter: temporal.data_converter

when@test:
  temporal:
    workerFactory: Temporal\Testing\WorkerFactory
```

Assign worker
-------------

[](#assign-worker)

Running workflows and activities with different task queue Add a [`AssignWorker`](src/Attribute/AssignWorker.php) attribute to your Workflow or Activity with the name of the worker. This Workflow or Activity will be processed by the specified worker.

**Workflow example:**

```
