Download the PHP package szana8/laraflow without Composer

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

Laravel Workflow Package

Laraflow is a standard workflow package for Laravel Eloquent objects. You can define your steps, the transition between them, callbacks, and validators.

Total Downloads Latest Stable Version License

Installation (via composer)

You can install the package via composer. The package require Laravel 8 or higher

You need to crate the necessary table for the historical data:

After Laravel 5.5 you don't need to manually add the service provider to the config/app.php.

Configuration file

After the installation you have to publish a configuration file, which contains a lot of necessary data for the package.

Configuration array

You need a configuration array before you use the Laraflow workflow.

Usage

Step 1

First you need to add a new column to your Eloquent model table for example called: last_step/status or whatever you want.

In your config file _propertypath attribute has to be the same value than the column name.

Step 2

You have to add the Flowable trait to your Eloquent model to use the workflow.

Step 3

Than you have to add a function to your eloquent model called getLaraflowStates() .

This function has to return the array of the configuration!

The configuration array, when just using 1 state machine in you model must of the form:

When you have multiple statemachines in your model use the following form:

Step 4

If you want to change the status of the Eloquent object you can use the

method which comes from the Flowable trait. The _\$newstatus parameter is the value of the key attribute which comes from the getPossibleTransitions() function.

History

You can query the history of the record just call the history function in your model like this:

Events

You can listen to the 'global' events which fires in every status changes.

The _PRETRANSITION fires before the status change, the _POSTTRANSITION fires after. The _CANTRANSITION fires when the package checks the transition is possible from the actual step. You can define callback(s) which will be call from the specified transition.

Validators

The package comes with a default validator class, which use the Laravel Validator class. You can add validation rules to the transitions, so the package can checks the Eloquent object attributes with the given rules before the transition. If the validation fails throws a LaraflowValidatorException exception with the error message(s) array.

You can define your own validator if you create a class which implements the LaraflowValidatorInterface.

Commands

Subscriber generation

You can create subscribers for the default Laraflow events with artisan command.

After the run you can find the new subscriber class in the App\Listener directory. To create a callback class you have to create a class which implements the LaraflowCallbackInterface and add the class to the neessary event in the subscriber.

Example:

Custom validator generation

To generate a validator class skeleton for the custom validation you use this command:

After the run you can find the new class in the App\Validators directory.

Credits

This library has been highly inspired by https://github.com/winzou/state-machine.

License

The package is open-sourced software licensed under the MIT license.


All versions of laraflow with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0
illuminate/support Version 9.* || 10.*
illuminate/database Version 9.* || 10.*
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 szana8/laraflow contains the following files

Loading the files please wait ....