Forest header image

Symfony Finland
Random things on PHP, Symfony and web development

A workflow component with framework integration coming in Symfony 3.2

By text definition a workflow is a sequence of connected steps tied to objects of some sorts. In each step a set of validations and actions are be applied. Most web developers are familiar with these type of flows and have likely implemented a workflow in one form or another.

In the Symfony world there have been alternatives for creating workflows like this, but with the upcoming release the Symfony project will have a dedicate component for creating and visualising workflows.

The work has been underway since 2014 by Grégoire Pineau, but things moved forward in the past weeks as the workflow component is to be included in Symfony 3.2 with complete integration to the full stack framework.

The component allows developers to define workflows like publishing and approval in a unified way using code or alternatively configuration when using the Symfony full stack framework:

framework:
    workflows:
        article:
            marking_store:
                type: property_accessor
            supports:
                - AppBundle\Entity\Article
            places:
                - draft
                - wait_for_journalist
                - approved_by_journalist
                - wait_for_spellchecker
                - approved_by_spellchecker
                - published
            transitions:
                request_review:
                    from: draft
                    to:
                        - wait_for_journalist
                        - wait_for_spellchecker

In addition to pure code or configuration views, developers can visualize their workflows to make them more accessible. An sample visualisation is the one below is implemented in the example application from Grégoire presented at Symfony Live Paris this April. It displays the current state of an article in a publishing workflow:Thumbnail

Together with the Symfony Expression Language the workflow component will enable developers to add commonly needed functionalities to their applications such as editorial workflows in CMSes without constant reinvention of the wheel.

The new component is hardly the only option for creating workflows in PHP or Symfony as complete solutions like the LexikWorkflowBundle and OroWorkflowBundle as well components like ZetaComponents Workflow and Alter Way Workflow.

The track record that Symfony has for stability and support makes the new component a worthwhile option in the long term. It is worth noting that the Symfony 3.2 release is not due until November 2016, so there is still plenty of work that needs to be done with documentation and so forth.

At this point the best place to learn about the upcoming Symfony Workflow component are:


Written by Jani Tarvainen on Saturday July 9, 2016
Permalink - Tags: symfony, workflow

« The JavaScript language reboot is done - Patents in Open Source licenses and the Facebook patent clause »