Download the PHP package zikula/wizard without Composer
On this page you can find all versions of the php package zikula/wizard. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download zikula/wizard
More information about zikula/wizard
Files in zikula/wizard
Informations about the package wizard
Added to monorepo
Wizard has been included into the core repository.
Wizard
The Wizard Component is a management tool for multi-stage user interaction. It utilizes several Interfaces and the
Wizard class to create a workflow that is compatible with Symfony Forms and Twig templating. Relying on the concept of
Stages, the developer is able to define a sequence using a .yml
file and control that sequence in their Controller.
On instantiation, the Wizard class requires a StageContainer and a full path to the stage definition file (in yaml format). The Wizard will load the stage definitions from there. The Wizard Component includes a YamlFileLoader for this purpose.
Create a concrete class that extends the Zikula\Component\Wizard\AbstractStageContainer
. Use autowiring and autoconfiguration
to configure the class:
Stage
A Stage is simply a class which implements the StageInterface. It defines a name, a template name and any
template parameters that stage will require. A stage must also define whether it is necessary by possibly
completing some logic and returning a boolean. Stages marked as NOT necessary will be skipped following their
instantiation and processing of the isNecessary()
method, allowing that stage to complete tasks as needed before
proceeding. Stages are skipped when the Wizard calls the getCurrentStage()
method.
Use Symfony autowiring and autoconfiguring or manual Dependency Injection to add services to your stages.
Stages may optionally implement:
InjectContainerInterface
if the Stage requires the Symfony containerFormHandlerInterface
if the Stage will be using a Symfony Form
The Wizard can be halted in the isNecessary()
method by throwing an AbortStageException
. The message of which is
available for retrieval using $wizard->getWarning()
.
Stage Definition File
The stage definition file is a simple yaml file. The first key stages:
is required and then each stage should be
listed by name
and each should have properties class
and order
. The name
key must be the same as the name of the
stage as set in its Stage class. The class
property should be the fully-qualified classname (with namespace) and the
order
property should be an integer identifying the sequential order of the stage. Optionally, a stage can be
identified with a default
property which should be set to true. This stage will be used by the wizard if no stage
argument is provided.
Sample stages.yml
Sample Controller
All versions of wizard with dependencies
symfony/config Version 4.*|5.*
symfony/dependency-injection Version 4.*|5.*
symfony/filesystem Version 4.*|5.*
symfony/form Version 4.*|5.*
symfony/http-foundation Version 4.*|5.*
symfony/yaml Version 4.*|5.*