Download the PHP package fproject/workflowii without Composer

On this page you can find all versions of the php package fproject/workflowii. 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 workflowii

Workflow Engine for Yii 2 Framework

Latest Stable Version Total Downloads Latest Unstable Version Build License

INSTALLATION

The preferred way to install Workflowii is through composer.

You can either run:

or add this block to the require section of your composer.json file:

REQUIREMENTS

The minimum requirement by Workflowii:

QUICK START

Configuration

In this simple start guide we use default configuration settings, but note that workflowii is designed to be highly flexible so to adapt to a lot of execution contexts.

Create A WorkflowSource

A workflow source is defined as a PHP class that implements the \fproject\workflow\core\IWorkflowSource interface. This interface declares the getDefinition() method that must return an array representing the workflow of a model object.

Let's define a very simple workflow source that will be used to manage article posts represented by Article model class. This workflow source will simply return the same workflow for all model object instances of Article, by specifying a PHP associative array as return value of getDefinition() method:

ArticleWorkflowSource.php

Attach ActiveWorkflowBehavior To The Model

Now let's have a look to our Article model that extends from \yii\db\ActiveRecord and has a column named status of type string.

The last step is to associate the workflow definition with articles models. All things we have to do is overriding the function behaviors() method in the Article model class and specify the ActiveWorkflowBehavior behavior as return value. That's all, the workflowii's default configuration settings will do the rest for you.

Article.php

By default, the ActiveWorkflowBehavior will search to find a workflow source class that has the same namespace with the model class and has the class name is the model class name with suffix WorkflowSource. In this case, it will be ArticleWorkflowSource.

Thus, we are now ready to play with ArticleWorkflowSource workflow that dedicated for Article model.

Let's Use It !

Now that we are all setup, we can use the ActiveWorkflowBehavior methods to set/get the status of our articles : the ActiveWorkflowBehavior will take care that the article doesn't reach a status where it is not supposed to go, depending on the workflow definition that we have created.

This will print the following message :

article status is : Draft

If you do the same thing but instead of draft set the status to published and try to save it, the following exception is thrown :

Not an initial status : ArticleWorkflow/published ("ArticleWorkflow/draft" expected)

That's because in your workflow definition the initial status is set to draft and not published.

Now we will go further. This time we are not going to perform the transition when the Article is saved (like we did in the previous example), but immediately by invoking the sendToStatus method. Our Article is going to try to reach status published passing through deleted which is strictly forbidden by the workflow. Will it be successful in this risky attempt of breaking workflow rules ?

There is no transition between deleted and published, and that's what Workflow tries to explain the problem:

Workflow Exception – fproject\workflow\core\WorkflowException
No transition found between status ArticleWorkflow/deleted and ArticleWorkflow/published

Yes, that's severe, but there was many ways to avoid this exception like for instance by first validating that the transition was possible.

What's Next ?

This is just a very simple way of using the ActiveWorkflowBehavior. Workflowii has much more functionalities enough to assist you in your workflow management inside your Yii 2 web app.

In the meantime you can have a look to the Workflowii User Guide (still under dev) and send any feedback.

ROADMAP

LICENSE

Workflowii is released under the Apache 2.0 License. See the bundled LICENSE.md for details.

LINKS


All versions of workflowii with dependencies

PHP Build Version
Package Version
Requires php Version >=5.4.0
yiisoft/yii2 Version *
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 fproject/workflowii contains the following files

Loading the files please wait ....