symfony-opcua · v4.3.x
Docs · Reference

Console commands

Every Symfony Console command the bundle adds. Signatures, options, common invocations.

The bundle ships one Symfony Console command. Trust-store operations are not Symfony commands — they live in the opcua-cli companion package (or you can call the programmatic trust-store API directly from your own commands).

Command Purpose
opcua:session Run the OPC UA session manager daemon

opcua:session

Start the daemon. Defined in src/Command/SessionCommand.php.

bash signature
php bin/console opcua:session
    [--timeout=<sec>]
    [--cleanup-interval=<sec>]
    [--max-sessions=<n>]
    [--socket-mode=<oct>]

All four options are defined in SessionCommand::configure():

Option Type YAML fallback
--timeout int (s) session_manager.timeout (default 600)
--cleanup-interval int (s) session_manager.cleanup_interval (30)
--max-sessions int session_manager.max_sessions (100)
--socket-mode octal session_manager.socket_mode (0600)

CLI flags override YAML config for that invocation. All values fall back to session_manager.* in the bundle config.

There is no --socket-path option, no --auth-token option — those values flow from YAML only. To change the socket path or auth token, edit php_opcua_symfony_opcua.session_manager.socket_path / auth_token and reload the daemon.

Detailed in Starting the daemon.

Trust-store management

The bundle does not ship trust-store Symfony commands. Use one of:

  • The standalone CLI from the opcua-cli companion package (provides opcua trust:add, trust:list, trust:remove).
  • Programmatic calls from your own Symfony commands. The underlying FileTrustStore (in opcua-client) exposes trust(), untrust(), list(), and friends — wire it into a custom app:trust:* command of your own design.

For the workflow itself (how to discover and pin a server certificate), see Security · Trust store.

Common patterns

Healthcheck script

bash healthcheck
#!/bin/bash
php bin/console opcua:session --help > /dev/null 2>&1 || exit 1
# Daemon registered = bundle loaded properly

App-defined commands (suggested)

The bundle leaves room for app-specific commands. Common ones:

Command (app-defined) Purpose
app:plc:discover Walk the address space, populate plc_tags
app:plc:sample One-shot read across all configured tags
app:opcua:resubscribe Re-create subscriptions after daemon restart
app:opcua:metrics Export metrics to Prometheus
app:opcua:cert:check Cert expiry monitor
app:opcua:trust:add Wrap FileTrustStore::trust()

See Recipes for worked examples.

Verbosity

When debugging, raise verbosity:

bash verbose
php bin/console opcua:session -v       # Notices
php bin/console opcua:session -vv      # Notices + info
php bin/console opcua:session -vvv     # Everything (debug)

For your own commands, use OpcuaManager::useConsoleLogger() to forward the verbosity into the OPC UA client's logger — see Console and scheduler.