1. Home
  2. Docs
  3. Developers
  4. Develop custom packages
  5. Workflow Components

Workflow Components

If you are defining components in your package there are two methods specified by a \Convo\Core\Factory\IComponentSource interface that you have to provide: getComponentDefinition() and createPackageComponent().

First off, after having written your component, register it in the protected _initDefinitions() method by initializing the _definitions to an array of \Convo\Core\Factory\ComponentDefinition. Provide the namespace, class name, component name, description, and properties.

If your component requires custom way to be created, you can provide factory implementation through _factory component property. Your factory should implements \Convo\Core\Factory\IComponentFactory and you can do it in anonymous way (check for the examples in provided packages).

Here is the list of the component types you can define and suggestion how to start

  • Elements \Convo\Core\Workflow\IConversationElement – you can use \Convo\Core\Workflow\AbstractWorkflowComponent or the \Convo\Core\Workflow\AbstractWorkflowContainerComponent as a base
  • Processors \Convo\Core\Workflow\IConversationProcessor – you can use \Convo\Core\Workflow\AbstractWorkflowContainerComponent as a base
  • Conversation block \Convo\Core\Workflow\IRunnableBlock – you can use \Convo\Core\Workflow\AbstractWorkflowContainerComponent as a base
  • Service context \Convo\Core\Workflow\IServiceContext – you can use \Convo\Core\Workflow\AbstractBasicComponent as a base

In all listed cases you have to name and implement target interface additionally to extending the base class.