Symfony DI Container Registration

Overview #

This guide explains how to register your connectors, applications, batch nodes, and custom nodes in Symfony's Dependency Injection container so the Orchesty PHP SDK can discover and use them.

Service Registration #

All SDK components must be registered as Symfony services with specific tags.

Connectors #

Tag: hbpf.connector

# config/services.yaml
services:
    hbpf.connector.hubspot-create-contact:
        class: YourApp\Connector\HubSpotCreateContactConnector
        arguments:
            - '@hbpf.application_install.repository'
        calls:
            - ['setSender', ['@hbpf.transport.curl_manager']]
            - ['setApplication', ['@hbpf.application.hubspot']]
        tags: ['hbpf.connector']

Applications #

Tag: hbpf.application

Basic/Token Authentication:

services:
    hbpf.application.hubspot:
        class: YourApp\Application\HubSpotApplication
        tags: ['hbpf.application']

OAuth2 Authentication:

services:
    hbpf.application.github:
        class: YourApp\Application\GitHubApplication
        arguments:
            - '@hbpf.authorization.oauth2.provider'
        tags: ['hbpf.application']

OAuth1 Authentication:

services:
    hbpf.application.twitter:
        class: YourApp\Application\TwitterApplication
        arguments:
            - '@hbpf.authorization.oauth1.provider'
        tags: ['hbpf.application']

Batch Nodes #

Tag: hbpf.batch

services:
    hbpf.batch.process-users:
        class: YourApp\Batch\ProcessUsersBatch
        arguments:
            - '@hbpf.application_install.repository'
        calls:
            - ['setSender', ['@hbpf.transport.curl_manager']]
        tags: ['hbpf.batch']

Custom Nodes #

Tag: hbpf.custom_node

services:
    hbpf.custom_node.data-transformer:
        class: YourApp\CustomNode\DataTransformerNode
        arguments:
            - '@hbpf.application_install.repository'
        tags: ['hbpf.custom_node']

Auto-Configuration #

For cleaner configuration, use auto-wiring and auto-tagging:

# config/services.yaml
services:
    _defaults:
        autowire: true
        autoconfigure: true

    # Auto-tag connectors
    _instanceof:
        Hanaboso\PipesPhpSdk\Connector\ConnectorAbstract:
            tags: ['hbpf.connector']
        Hanaboso\PipesPhpSdk\Application\Base\ApplicationInterface:
            tags: ['hbpf.application']
        Hanaboso\PipesPhpSdk\Batch\BatchInterface:
            tags: ['hbpf.batch']
        Hanaboso\PipesPhpSdk\CustomNode\CommonNodeInterface:
            tags: ['hbpf.custom_node']

    # Auto-register your components
    YourApp\Connector\:
        resource: '../src/Connector'

    YourApp\Application\:
        resource: '../src/Application'

    YourApp\Batch\:
        resource: '../src/Batch'

    YourApp\CustomNode\:
        resource: '../src/CustomNode'

Required Services #

These SDK services must be available:

services:
    # Application install repository
    hbpf.application_install.repository:
        class: Hanaboso\PipesPhpSdk\Application\Repository\ApplicationInstallRepository

    # HTTP client
    hbpf.transport.curl_manager:
        class: Hanaboso\CommonsBundle\Transport\Curl\CurlManager

    # OAuth2 provider (if using OAuth2)
    hbpf.authorization.oauth2.provider:
        class: Hanaboso\PipesPhpSdk\Authorization\Provider\OAuth2Provider

    # OAuth1 provider (if using OAuth1)
    hbpf.authorization.oauth1.provider:
        class: Hanaboso\PipesPhpSdk\Authorization\Provider\OAuth1Provider

Service Naming Convention #

Follow these naming patterns:

  • Connectors: hbpf.connector.{name}
    Example: hbpf.connector.hubspot-create-contact
  • Applications: hbpf.application.{name}
    Example: hbpf.application.hubspot
  • Batch: hbpf.batch.{name}
    Example: hbpf.batch.process-users
  • Custom Nodes: hbpf.custom_node.{name}
    Example: hbpf.custom_node.data-transformer

Complete Example #

# config/services.yaml
services:
    _defaults:
        autowire: true
        autoconfigure: true

    # Application
    hbpf.application.hubspot:
        class: YourApp\Application\HubSpotApplication
        tags: ['hbpf.application']

    # Connector using the application
    hbpf.connector.hubspot-create-contact:
        class: YourApp\Connector\HubSpotCreateContactConnector
        arguments:
            - '@hbpf.application_install.repository'
        calls:
            - ['setSender', ['@hbpf.transport.curl_manager']]
            - ['setApplication', ['@hbpf.application.hubspot']]
        tags: ['hbpf.connector']

    # Custom node
    hbpf.custom_node.email-validator:
        class: YourApp\CustomNode\EmailValidatorNode
        arguments:
            - '@hbpf.application_install.repository'
        tags: ['hbpf.custom_node']

    # Batch processor
    hbpf.batch.bulk-email-sender:
        class: YourApp\Batch\BulkEmailSenderBatch
        arguments:
            - '@hbpf.application_install.repository'
        calls:
            - ['setSender', ['@hbpf.transport.curl_manager']]
            - ['setApplication', ['@hbpf.application.sendgrid']]
        tags: ['hbpf.batch']

Verification #

To verify your services are registered:

# List all connectors
php bin/console debug:container --tag=hbpf.connector

# List all applications
php bin/console debug:container --tag=hbpf.application

# List all batch nodes
php bin/console debug:container --tag=hbpf.batch

# List all custom nodes
php bin/console debug:container --tag=hbpf.custom_node

See Also #

© 2025 Orchesty Solutions. All rights reserved.