Download the PHP package aaronsaray/php-flow-control without Composer

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

PHP Flow Control

This library assists with creating a flow control or process flow in PHP. It really is just a scaffolding for developing your own workflow process in PHP.

Installation Instructions

Install the latest version with

Documentation

Getting Started

The goal here is to remember that each work flow (point) should only know about the next possible scenario. These particular ones were not built yet to go backwards. :) With this in mind, use this scaffolding to create a PHP flow control.

If you think about it as a tree going to the next step, that will help. You can have 1-n possible outcomes for the 'next' point to go to.

Points have payloads which determine the thing to take action on. This could be an object retrieved from a database (imagine a user-built system that handles user-determined flows), or a single URL for redirect requests in your controller.

An Example

In this particular example, we're going to make a multi-step wizard. We know the current order of the steps, but the business rules sometimes changes. Sometimes certain steps must happen first - other times the object we're updating might have different properties that are needed.

In this example, we're going to have three steps:

Finally, we'll see the results at /your/results/are/here/question_id

This Payload is a very simple object. All it does is pass a single string url back. This payload could be very advanced, based on your business rules. This object is not limited to just working with strings - it could return a whole new object or even dictate the application progresses to a different flow.

Each workflow consists of points and a director. The director's main job is to indicate what the start of the workflow is, like this example. The rest of the functionality is in the abstract. In this case, the first step to our process is this point.

This class is the object that we're tracking. Super complicated, I know...

This is where you begin to see the power of the workflow. The get payload creates a payload object that represents the current state. In our example, our state is a URL reference - so this is the URL for this particular point.

The next() method call passes in the question object. From there, it does business logic to determine if we can go to the next point (or question). If there is no business validation necessary, you could simply just return the next point. In this particular case, we don't want to ask about the age (in the next point) until we have a name. We assume that sometime in the runtime of this particular call, a name was assigned to the question.

Here you can see an example of how the payload might be altered by the particular processable object.

From here, the rest of the objects look the same - with the exception of any point that ends a tree/workflow. This one does not need to have the next() method - as it should only throw an exception to indicate that there are no more points. (The abstract already does this).

So next, in our example, let's begin the request. We want to ask for the first point and put it in a link.

Imagine a scenario where the user could drop off from the workflow - but should be able to pick it up again? You'd call the getLastAllowed() method to get the last one that they could possibly access. For example, if the user answered their name and their age, the following example would return a link to /do-you-like-cake?id=question_id based on our example.

During the various steps, you will need to interact with the points. Imagine the scenario after a successful submit of the name question:

This allows your controller to understand that it should assign values or do any other controller-logic, but it doesn't necessarily need to know where it's sending the workflow next.

About

I was creating a multi-step application again - a wizard based system - and I kept thinking that I do this alot, I wish there was an easier way to do this. It got even worse when the steps / order of the steps change. I decided to create this scaffolding as a way to develop your own process or workflow control in PHP.

Requirements

Bugs and Feature Requests

Bugs and feature request are tracked on GitHub

Author

Aaron Saray - http://aaronsaray.com

License

This library is licensed under the MIT License - see the LICENSE file for details

Acknowledgements

We're using this flow controller in our work at https://www.smallshopsunited.com - stop by and check it out.


All versions of php-flow-control with dependencies

PHP Build Version
Package Version
Requires php Version >=5.3.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 aaronsaray/php-flow-control contains the following files

Loading the files please wait ....