IDCI logo
French flag English flag

Introduction to IDCIStepBundle

Introduction

Result of a customer's need, we wonder how to solve the problem of the creation of an interactive workflow. We had to easily do navigable routes for an internaut and easily trigger different processes (mail sending, datebase saving, web service calling) depending on users action (moving from step to an other). The upgradeability of the routes' complexity being a big point, the whole workflow had to be configurable (and non hardcoded).

We have tested existing bundles, which seemed to answer our problem, but they wasn't suitable. At the end of this page, we added a quick compararison of these different bundles.

In this way, we choose to develop our own Bundle, we made it generic and reusable.

This article helps to introduce IDCIStepBundle. In upcomming articles, we will deepen details and talk about specificities through concrete examples.

IDCIStepBundle simplify the creation of an interactive workflow for an internaut. Its configuration is defined by a system of Map, Step and Path. We used the navigation metaphor throughout our development.

In the first instance, we need to defined a map, and imagine each screen (web page) as a step, then link them to each others using paths which will add navigation buttons.

This Bundle is compatible with Symfony 2.8 version. The 3.0 version will be available soon.

What is a map ?

A map defined the navigation workflow, it is composed of steps and paths.

What is a step ?

A step materialize as a web page, and defined a potential crossing point. It can be of different types. By default, our bundle provides two types of step :

  • html : display of HTML content
  • form : display of a form (FormType Symfony)

What is a path ?

A path is an itinerary which have a step as an origin and none or several steps as destination. It can be of different types. By default, our bundle provides three types de path :

  • single : only one destination.
  • conditionnel : several destinations according conditional rules.
  • end : the path which determine a end of navigation.

Key

We will use a diagram which will be a key.

  • Squares represent steps.
  • Arrows represent paths.

Key IDCIStepBundle

Why use IDCIStepBundle ?

IDCIStepBundle allows simple routes (one step, one path) as much as complex routes (several steps and paths). You can easily begin from a configuration, which represent the map, using the yml or json language. You also can represent a map by directly using object oriented programmation, but this can be more complicated for outsiders of code and object oriented programmation.

Here is an incomplete list of StepBundle use case :

  • A contact form,
  • A sign in process,
  • A questionnaire,
  • A survay,
  • Etc.

Without delay, let's meet this Bundle.

Let's begin with creating a Symfony project in 2.8 version, we will call this project demo_step.

$ composer create-project symfony/framework-standard-edition demo_step "2.8.*"

Installation

Let's add the dependency with our bundle, by modifying the composer.json file :

"require": {
    ...
    "idci/step-bundle": "~1.5"
},

Or by executing the following composer command :

$ composer require idci/step-bundle:~1.5

Then, let's intall this new dependency by using composer :

$ composer update

Let's declare the bundle in our AppKernel.php file :

<?php
// app/AppKernel.php

public function registerBundles()
{
    $bundles = array(
...
new JMS\SerializerBundle\JMSSerializerBundle(),
new IDCI\Bundle\StepBundle\IDCIStepBundle(),
    );
}

Finally, let's add the configuration specificities of this Bundle in our app. For this, let's edit the app/config/config.yml file :

imports:
    ...
    - { resource: @IDCIStepBundle/Resources/config/config.yml }

Our Bundle is installed and ready to use.

In our next article, we will test a concret case of using IDCIStepBundle : the creation or a contact form.

Comparison

Here is a comparison table (strengths / weaknesses) of Bundles allowing the creation of interactive workflows.

Bundle Strengths Weaknesses
CraueFormFlowBundle
  • Compatible with symfony2 and 3.
  • Step backwards allowed on several levels with conservation of data inputed at each steps.
  • Two possible strategy (a "FormType" for all the flow, or a "FormType" by step)
  • Creation of multiple files is necessary to make complex routes because 1 file = 1 step.
  • No record of all navigation datas (when update)
  • We cannot defined steps in the configuration.
  • No concept of paths, the steps follow themself chronologically.
IDCIStepBundle
  • Usage of paths linking steps, which allow a non chronological navigation between each steps.
  • Routes entierely configurable (json/yaml), also possibility of hardcoding them.
  • Save all datas inputed or recovered during the navigation.
  • Possible step barkwards on multiple levels with storage of inputed datas at each steps.
  • Native usage of "fusion fields" allowing easy recover of inputed datas or others.
  • Integrated "debugger" including the history and navigation datas.
  • Possibility to connect "EventActions" on "paths" or "steps".
  • Only compatible with Symfony2 for the time being.
  • The configuration quickly become very heavy.

Other bundles were quickly analysed but not tested

If you need help or an expertise about IDCIStepBundle you can contact us.