Download the PHP package effiana/formflow-bundle without Composer

On this page you can find all versions of the php package effiana/formflow-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package formflow-bundle

Information

Build Status Coverage Status

CraueFormFlowBundle provides a facility for building and handling multi-step forms in your Symfony project.

Features:

A live demo showcasing these features is available at http://craue.de/symfony-playground/en/CraueFormFlow/.

Installation

Get the bundle

Let Composer download and install the bundle by running

in a shell.

Enable the bundle

If you don't use Symfony Flex, register the bundle manually:

Or, for Symfony 3.4:

Usage

This section shows how to create a 3-step form flow for creating a vehicle. You have to choose between two approaches on how to set up your flow.

Approach A: One form type for the entire flow

This approach makes it easy to turn an existing (common) form into a form flow.

Create a flow class

Create a form type class

You only have to create one form type class for a flow. There is an option called flow_step you can use to decide which fields will be added to the form according to the step to render.

Approach B: One form type per step

This approach makes it easy to reuse the form types to compose other forms.

Create a flow class

Create form type classes

Register your flow as a service

XML

YAML

When not using autoconfiguration, you may let your flow inherit the required dependencies from a parent service.

XML

YAML

Create a form template

You only need one template for a flow. The instance of your flow class is passed to the template in a variable called flow so you can use it to render the form according to the current step.

CSS

Some CSS is needed to render the buttons correctly. Load the provided file in your base template:

...and install the assets in your project:

Buttons

You can customize the default button look by using these variables to add one or more CSS classes to them:

Example with Bootstrap button classes:

In the same manner you can customize the button labels:

Example:

You can also remove the reset button by setting craue_formflow_button_render_reset to false.

Create an action

Explanations

How the flow works

  1. Dispatch PreBindEvent.
  2. Dispatch GetStepsEvent.
  3. Update the form data class with previously saved data of all steps. For each one, dispatch PostBindSavedDataEvent.
  4. Evaluate which steps are skipped. Determine the current step.
  5. Dispatch PostBindFlowEvent.
  6. Create the form for the current step.
  7. Bind the request to that form.
  8. Dispatch PostBindRequestEvent.
  9. Validate the form data.
  10. Dispatch PostValidateEvent.
  11. Save the form data.
  12. Proceed to the next step.

Method loadStepsConfig

The array returned by that method is used to create all steps of the flow. The first item will be the first step. You can, however, explicitly index the array for easier readability.

Valid options per step are:

Examples

Advanced stuff

Validation groups

To validate the form data class bound to the flow, a step-based validation group is passed to the form type. By default, if the flow's getName method returns createVehicle, such a group is named flow_createVehicle_step1 for the first step. You can customize this name by setting the flow's property validationGroupPrefix explicitly. The step number (1, 2, 3, etc.) will be appended by the flow.

Compared to standalone forms, setting the validation_groups option in your form type's configureOptions method won't have any effect in the context of a flow. The value is just ignored, i.e. will be overwritten by the flow. But there are other ways of defining custom validation groups:

The generated step-based validation group will be added by the flow, unless the validation_groups option is set to false, a closure, or a GroupSequence. In this case, it will not be added by the flow, so ensure the step forms are validated as expected.

Disabling revalidation of previous steps

Take a look at #98 for an example on why it's useful to revalidate previous steps by default. But if you want (or need) to avoid revalidating previous steps, add this to your flow class:

Passing generic options to the form type

To set options common for the form type(s) of all steps you can use method setGenericFormOptions:

Passing step-based options to the form type

To pass individual options to each step's form type you can use the step config option form_options:

Alternatively, to set options based on previous steps (e.g. to render fields depending on submitted data) you can override method getFormOptions of your flow class:

Enabling dynamic step navigation

Dynamic step navigation means that the step list rendered will contain links to go back/forth to a specific step (which has been done already) directly. To enable it, add this to your flow class:

If you'd like to remove the parameters (added by using such a direct link) when submitting the form you should modify the action for the opening form tag in the template like this:

Handling of file uploads

File uploads are transparently handled by Base64-encoding the content and storing it in the session, so it may affect performance. This feature is enabled by default for convenience, but can be disabled in the flow class as follows:

By default, the system's directory for temporary files will be used for files restored from the session while loading step data. You can set a custom one:

Enabling redirect after submit

This feature will allow performing a redirect after submitting a step to load the page containing the next step using a GET request. To enable it, add this to your flow class:

But you still have to perform the redirect yourself, so update your action like this:

Using events

There are some events which you can subscribe to. Using all of them right inside your flow class could look like this:


All versions of formflow-bundle with dependencies

PHP Build Version
Package Version
Requires php Version ~7.0
symfony/config Version ~3.4|~4.2|~5.0
symfony/dependency-injection Version ~3.4|~4.2|~5.0
symfony/event-dispatcher Version ~3.4|~4.2|~5.0
symfony/form Version ~3.4|~4.2|~5.0
symfony/http-foundation Version ~3.4|~4.2|~5.0
symfony/http-kernel Version ~3.4|~4.2|~5.0
symfony/options-resolver Version ~3.4|~4.2|~5.0
symfony/security-core Version ~3.4|~4.2|~5.0
symfony/translation Version ~3.4|~4.2|~5.0
symfony/validator Version ~3.4|~4.2|~5.0
symfony/yaml Version ~3.4|~4.2|~5.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package effiana/formflow-bundle contains the following files

Loading the files please wait ....