The Workflow Package add Drag & Drop Workflows to your Laravel Application.

Overview

Workflows add Drag & Drop automation's to your Laravel application.

Latest Version on Packagist Build Status Quality Score Total Downloads

Logo

The Workflow Package adds Drag & Drop Workflows to your Laravel Application. A Workflow consists of Triggers and Tasks. The Trigger is responsible for starting a Workflow. The Tasks are single nodes of code execution. The package comes with some handy tasks bundled, but you can easily write your own as well.

Screenshot

If you are interested in news and updates

Video Tutorial

Alt text

Installation

You can install the package via composer:

composer require the42coders/workflows

You need to register the routes to your web.php routes File as well. Since the Workflow Package is very powerful make sure to secure the routes with whatever authentication you use in the rest of your app.

Route::group(['middleware' => ['auth']], function () {
    \the42coders\Workflows\Workflows::routes();
});

You need to publish the assets of the Package

php artisan vendor:publish --provider="the42coders\Workflows\WorkflowsServiceProvider"  --tag=assets  

Other publishable Contents are

config

php artisan vendor:publish --provider="the42coders\Workflows\WorkflowsServiceProvider"  --tag=config  

language

php artisan vendor:publish --provider="the42coders\Workflows\WorkflowsServiceProvider"  --tag=lang  

views

php artisan vendor:publish --provider="the42coders\Workflows\WorkflowsServiceProvider"  --tag=views  

Usage

The Workflow Package is working out of the Box in your Laravel application. Just go to the route /workflows to get started.

Workflows

A Workflow is gets started by a Trigger and then executes the Tasks in the Order you set them. To pass information between the Tasks we have the DataBus.

Triggers

A Trigger is the Starting Point and defines how a Workflow gets called. More Triggers coming soon.

ObserverTrigger

The Observer Trigger can listen to Eloquent Model Events and will then pass the Model which triggered the Event to the Workflow.

To make it Work add the WorkflowObservable to your Eloquent Model.

 use WorkflowObservable;

ButtonTrigger

The Button Trigger is able to render a button in your "frontend" and Execute a Workflow based by a click on it. ButtonTrigger also accept an Model which they pass to the Workflow.

You can influence the buttons by adding your own classes or styles directly to each ButtonTrigger. Also you can publish the blade and change it according to your needs.

You have multiple ways of rendering ButtonTrigger.

ByName
 {!! the42coders\Workflows\Triggers\ButtonTrigger::renderButtonByName('name', $model) !!}
ByWorkflowId
 {!! the42coders\Workflows\Triggers\ButtonTrigger::renderButtonByWorkflowId(workflow_id, $model) !!}
ByCategory

This will return all Triggers from the Category.

 {!! the42coders\Workflows\Triggers\ButtonTrigger::renderButtonsByCategory('categoryName', $model) !!}

Tasks

A Task is a single code execution Node in the Workflow.

Task Description
ChangeModel Changes an Eloquent Model (Its not saving the changes to the DB)
DomPDF The DomPDF Task offers you a way to generate a PDF from HTML and put it to the DataBus (Works great with the HtmlInput Task).
Execute The Execute Task offers you to execute Shell Commands and is able to push the output of them to the DataBus.
HtmlInput The HtmlInput Task offers you a Trix Input Field which is able to render Blade. You can put in placeholders for dynamic content in two Ways. From the Model passed through the Workflow or from the DataBus.
HttpStatus The HttpStatus offers you a way to receive the Http Status of a given URL.
PregReplace The PregReplace Task offers you a way to to a preg replace on a Value from the Model or a DataBus Variable.
LoadModel Loads an Eloquent Model from the DB. You can provide the Class and the id.
SaveFile The SaveFile Task allows you to save Data to a File. Works easily with your registered Storage defines.
SaveModel Saves an Eloquent Model.
SendMail The SendMail Task allows you to send a Mail. You can pass the Content and Attachments to it. (Works great with HtmlInput and DomPDF)
SendSlackMessage This Task let you send a Slack Message. Please read the Section about Slack Notifications to make your app ready too use this.

SendSlackMessage

To send Slack messages you need to follow this 3 points.

  1. You need to install Slack notifications Laravel Slack Documentation
  2. You need to set up an incoming Slack Webhook Slack Documentation
  3. Set the WebhookUrl to your env file with WORKFLOW_SLACK_CHANNEL=YourSlackWebhookUrl

DataBus

The DataBus is a way to pass information between the single Tasks. This keeps the Tasks independent of each other.

Resource Description
ValueResource The Value Resource is the simplest Resource. You can just write your Data in an input field.
ConfigResource The Config Resource lets you access values from your Config Files.
ModelResource The ModelResource lets you access the Data from the passed Eloquent Model.
DataBusResource The DataBusResource lets you access the Data from the DataBus. This means all values which got set by a previous Task are access able here.

Testing

composer test

Changelog

Please see CHANGELOG for more information about what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email [email protected] instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.

Laravel Package Boilerplate

This package was generated using the Laravel Package Boilerplate.

Comments
  • PHP8 seems to make troubles

    PHP8 seems to make troubles

    The installed Versions: Development Environment: Windows 10, latest Composer version 2.0.11 PHP 8.0.3 Laravel Framework 8.33.1

    The composer commands I needed to start with parameter --ignore-platform-reqs in order to ignore the 7.x requirement.

    Then I'm using the "php artisan serve" to run on my local environment. And the latest Chrome Browser to start http://localhost:8000/workflows

    Now I follow your video Tutorial. When I want to configure the HTML input, the dialog is not opening.

    opened by hobbycodersince1990 5
  • missformed url - missing path

    missformed url - missing path

    I have installed in a Laravel 9 environment that has a path 'domain/crm' that redirects to 'domain/crm/admin' once authenticated. I can launch the 'index.blade' as domain/crm/admin/workflows, and the URL for the CREATE button is domain/create. If I set the prefix value in config/workflow.php to admin, the URL for the CREATE button is now domain/crm/admin/admin/create.

    What I have found, if I set the prefix value in config/workflow.php the domain and path (i.e. domain/crm) is added as a prefix as well as the config/workflow.php value as the URL, however if the is no config/workflow.php value then only the domain is added as a prefix.

    Workaround is to replace blade occurances of {{ config(workflows,prefix) }} with {{ url ('/') }} in the blade files.

    opened by hikoukinin 4
  • Unable to Install with php 8.0 and laravel 9 framework

    Unable to Install with php 8.0 and laravel 9 framework

    This is my composer.json

    { "name": "laravel/laravel", "type": "project", "description": "The Laravel Framework.", "keywords": ["framework", "laravel"], "license": "MIT", "require": { "php": "^8.0.2", "guzzlehttp/guzzle": "^7.2", "laravel/fortify": "^1.11", "laravel/framework": "^9.2", "laravel/sanctum": "^2.14.1", "laravel/tinker": "^2.7", "owen-it/laravel-auditing": "^12.2", "realrashid/sweet-alert": "^5.0", "santigarcor/laratrust": "^7.0", "spatie/laravel-permission": "^5.5", "symfony/event-dispatcher-contracts": "^2.4", "yajra/laravel-datatables-oracle": "~9.0", "zerodahero/laravel-workflow": "^4.0" }, "require-dev": { "fakerphp/faker": "^1.9.1", "laravel/sail": "^1.0.1", "mockery/mockery": "^1.4.4", "nunomaduro/collision": "^6.1", "phpunit/phpunit": "^9.5.10", "spatie/laravel-ignition": "^1.0" }, "autoload": { "psr-4": { "App\": "app/", "Database\Factories\": "database/factories/", "Database\Seeders\": "database/seeders/" } }, "autoload-dev": { "psr-4": { "Tests\": "tests/" } }, "scripts": { "post-autoload-dump": [ "Illuminate\Foundation\ComposerScripts::postAutoloadDump", "@php artisan package:discover --ansi" ], "post-update-cmd": [ "@php artisan vendor:publish --tag=laravel-assets --ansi --force" ], "post-root-package-install": [ "@php -r "file_exists('.env') || copy('.env.example', '.env');"" ], "post-create-project-cmd": [ "@php artisan key:generate --ansi" ] }, "extra": { "laravel": { "dont-discover": [] } }, "config": { "optimize-autoloader": true, "preferred-install": "dist", "sort-packages": true }, "minimum-stability": "dev", "prefer-stable": true }

    but when i install the42coders/workflows it give me error

    Problem 1 - barryvdh/laravel-dompdf v0.9.0 requires illuminate/support ^5.5|^6|^7|^8 -> found illuminate/support[v5.5.0, ..., 5.8.x-dev, v6.0.0, ..., 6.x-dev, v7.0.0, ..., 7.x-dev, v8.0.0, ..., 8.x-dev] but these were not loaded, likely because it conflicts with another require. - the42coders/workflows 0.0.12 requires barryvdh/laravel-dompdf ^0.9.0 -> satisfiable by barryvdh/laravel-dompdf[v0.9.0]. - Root composer.json requires the42coders/workflows ^0.0.12 -> satisfiable by the42coders/workflows[0.0.12].

    You can also try re-running composer require with an explicit version constraint, e.g. "composer require the42coders/workflows:*" to figure out if any version is installable, or "composer require the42coders/workflows:^2.1" if you know which you need

    opened by ershadow786 3
  • null given when starting a workflow

    null given when starting a workflow

    I've set up a basic observer workflow on the User model to trigger when it is updating. I trigger the update by modifying in Nova, similar to the demo video in the README.

    It seems in the start() method of the Trigger, the $this->workflow variable is null:

    the42coders\Workflows\Triggers;
    
    $log = WorkflowLog::createHelper($this->workflow, $model, $this);
    

    Digging into the database, it seems the trigger is referencing the wrong workflow_id (In my case, it was referencing a deleted Workflow (ID: 3) when it should have been referencing the only Workflow in the system (ID: 6) Therefore, this worked:

    $log = WorkflowLog::createHelper(Workflow::find(6), $model, $this);

    And the queue ran as expected.

    My assumption is that the Workflow model needs a cascading delete?

    opened by MCKLtech 2
  • Parallel execution?

    Parallel execution?

    Interesting package.

    Lets say I want to implement multi-approver to a Blog Post. Where I need them to run it parallel. Then the flow will look something like this:

    multi-approver

    Would it be possible to use a parallel execution in this package? (called Parallel Gateway in BPMN 2.0 spec)

    if not, any plans to support it?

    Cheers

    opened by viezel 2
  • workflow_app.blade.php displaying (404 errors) .

    workflow_app.blade.php displaying (404 errors) .

    13: , url incomplete should include 'resources' to be 20: <link href="{{ asset('css/app.css') }}" rel="stylesheet">, url incomplete should include 'resources' to be <link href="{{ asset('resources/css/app.css') }}" rel="stylesheet"> 21: <link href="{{ asset('css/workflow.css') }}" rel="stylesheet">, url incomplete should include 'vendor/workflows' to be <link href="{{ asset('vendor/workflows/css/workflow.css') }}" rel="stylesheet">

    opened by hikoukinin 1
  • Table Prefix only considered on up method

    Table Prefix only considered on up method

    Looks like a nice package. I was reviewing the code, I noticed you allow prefixing the table names. The migrations only use the prefix on the up() method. When calling down via a rollback, you could end up dropping a different table. Kind of a critical issue.

    {
        /**
         * Run the migrations.
         *
         * @return void
         */
        public function up()
        {
            Schema::create(config('workflows.db_prefix').'workflows', function (Blueprint $table) {
                $table->id();
                $table->string('name');
                $table->timestamps();
            });
        }
    
        /**
         * Reverse the migrations.
         *
         * @return void
         */
        public function down()
        {
            Schema::dropIfExists('workflows');
        }
    }
    
    opened by freestyledork 1
  • Feature/new task load model

    Feature/new task load model

    Add LoadModel Task Add ChangeModel Task Add SaveModel Task Change HtmlInput Task Icon DataBus setOutput function is now not auto converting to String so objects can be passed.

    opened by Max-Hutschenreiter 0
  • fix file input without value

    fix file input without value

    branch bugfix-file-no-value changes: modified: src/DataBuses/DataBus.php

    Error: Argument 2 passed to the42coders\Workflows\DataBuses\ValueResource::getData() must be of the type string, null given, called in [...]/vendor/the42coders/workflows/src/DataBuses/DataBus.php on line 29

    opened by tiagofrancafernandes 0
  • [WIP] Allow Tasks and Triggers to define their translations

    [WIP] Allow Tasks and Triggers to define their translations

    This merge request allow Tasks and Triggers to define their translations for themselves, instead of pulling them from the config file.

    The default is still following the convention used within the package.

    This allows 3rd party plugins/packages to add new triggers/tasks more easily.

    opened by maxeckel 0
  • Add PHP 8.0 support

    Add PHP 8.0 support

    This MR adds support for PHP 8.

    In order to do this, an update to "barryvdh/laravel-dompdf" v0.9.0 has been necessary. The update doesn't break any functionality and the tests pass.

    opened by maxeckel 0
  • Individual Item Workflows?

    Individual Item Workflows?

    We are looking at building a form submission system, whereby it can have several steps (Workflow) and then going through a set of steps dependent on the values entered.

    Is this possible within this package? From what I can see, it only applies to whole models without individualization to the model items.

    opened by TonyPartridgeR 0
  • addTrigger and addTask - 403 errors at workflow.js:28654

    addTrigger and addTask - 403 errors at workflow.js:28654

    addTrigger flow:

    addNode - workflow.js:38664 dispatch - workflow.js:38961 (anonymous) - workflow.js:38262 (anonymous) - 1:220 ajax - workflow.js:27976 send - workflow.js:28454

    opened by hikoukinin 7
  • index.blade.php and diagram.blade.php - awesome font icons not displaying (403 errors)

    index.blade.php and diagram.blade.php - awesome font icons not displaying (403 errors)

    index.blade.php and diagram.blade.php - awesome font icons not displaying (403 errors) .

    workflow.css 6229, 6230, 6243, 6244, 6257 & 6258: url is currently missing path (domain/public/fonts...... and not domain/path/public/public/fonts........).

    if WorkflowsServiceProvider.php: "DIR.'/../public/fonts' => public_path('public/fonts')" should be changed to "DIR.'/../fonts' => public_path('fonts'). Correct url would then be 'domain/path/public/fonts.........

    opened by hikoukinin 2
  • Doesn't work straight from the box

    Doesn't work straight from the box

    If you create a blank project, and add the workflow module as per the instructions you will get a

    Route [login] not defined

    Might be nice to document a simple implementation of this...

    Just a thought.

    opened by MilesHart 0
  • Is a task aware of it's position in the workflow?

    Is a task aware of it's position in the workflow?

    This is better suited to a discussion but is related to #21 and delaying a workflow that I hope to help implement. I note there does not seem to be a way to determine at what position a task is in the workflow e.g. If a workflow has 6 tasks, is it possible to know during a run of the workflow which particular task is in progress?

    My logic is that if we implement a 'delay' task and know the position in a workflow, it could be a simple case of 'pausing' at that task, and when it resumes, we simply restart the workflow from that position.

    At the moment, unless I am wrong, the workflow simply runs all tasks in the order in which they are added. This, again if I'm not mistaken, does not allow for re-ordering of tasks as they are run by add date, not their order on the builder.

    opened by MCKLtech 1
  • Is it possible to delay a Workflow?

    Is it possible to delay a Workflow?

    I'm wondering about the feasibility of delaying a workflow? For example, wait one hour, then send an email, wait two days, send another email.

    Would a custom trigger that calls itself at a later point in time be a potential solution?

    opened by MCKLtech 5
Releases(0.0.16)
Owner
42coders
Laravel Agency
42coders
Venture allows you to create and manage complex, async workflows in your Laravel apps.

Venture is a package to help you build and manage complex workflows of interdependent jobs using Laravel's queueing system. Installation Note: Venture

Kai Sassnowski 680 Dec 14, 2022
Detect flaws in your architecture, before they drag you down into the depths of dependency hell ...

Detect flaws in your architecture before they drag you down into the depths of dependency hell ... What it does System Requirements Installation Phive

Michael Haeuslmann 507 Dec 27, 2022
This repository aims to build a fairly complete CI/CD example using GitHub workflows and actions.

CI/CD example This repository aims to build a fairly complete CI/CD example using GitHub workflows and actions. Keep in mind that the toolset used in

Robin Ingelbrecht 4 Nov 1, 2022
Laravel Blog Package. Easiest way to add a blog to your Laravel website. A package which adds wordpress functionality to your website and is compatible with laravel 8.

Laravel Blog Have you worked with Wordpress? Developers call this package wordpress-like laravel blog. Give our package a Star to support us ⭐ ?? Inst

Binshops 279 Dec 28, 2022
This package is aimed to be a simplistic PHP workflow package that works in a similar fashion to GitHub Actions.

Workflow This package is aimed to be a simplistic PHP workflow package that works in a similar fashion to GitHub Actions. Installation To install this

Steve McDougall 4 Sep 26, 2022
This package makes it easy to add early access mode to your existing application.

This package makes it easy to add early access mode to your existing application. This is useful for when you want to launch a product and need to gat

Neo 174 Nov 26, 2022
An ultra-fast Laravel docs search workflow for Alfred 3+.

Laravel Docs Workflow for Alfred An ultra-fast Laravel docs search workflow for Alfred 3+. Installation Download the latest version Install the workfl

Till Krüss 317 Dec 21, 2022
Receiver is a drop-in webhook handling library for Laravel.

Receiver Receiver is a drop-in webhook handling library for Laravel. Webhooks are a powerful part of any API lifecycle. Receiver aims to make handling

Adam Campbell 270 Jan 6, 2023
Alfred workflow to convert a Discord snowflake to time

Snowcord for Alfred Takes a Discord snowflake and converts it to a time (UTC, local and Unix timestamp). Also connects with Alfred-Whencord Download D

null 2 Jan 6, 2022
An Alfred 4 workflow for quickly opening directories in Visual Studio Code

Alfred Workflow - Open in Visual Studio Code An Alfred 4 workflow opening files or folders with Visual Studio Code. Note: Alfred Powerpack is required

Daan Hage 2 Jun 27, 2022
A drop-in replacement for the Magento 2 checkout.

Clean Checkout for Magento 2 A drop-in replacement for the Magento 2 checkout. Features Modules The project is divided into several modules: Overall c

Daniel Sloof 275 Sep 14, 2022
A faster drop in replacement for bin/magento cache:clean with file watcher

"You know, hope is a mistake. If you can't fix what's broken, you'll, uh... you'll go insane." - Max Rockatansky Magento 2 Cache Clean A faster drop i

mage2tv 460 Dec 26, 2022
This Repository contains a custom Workflow for Alfred which provides the function to instantly search in the Magento 2 DevDocs

Introduction Add the custom search to your Alfred Workflow and have a quicker access to the Magento 2 DevDocs. Installation Just download the alfredwo

David Lambauer 10 Jun 29, 2022
Igbinary is a drop in replacement for the standard php serializer.

igbinary Igbinary is a drop in replacement for the standard php serializer. Instead of the time and space consuming textual representation used by PHP

Igbinary development 727 Dec 21, 2022
A Symfony2 bundle that integrates Select2 as a drop-in replacement for a standard entity field on a Symfony form.

select2entity-bundle Introduction This is a Symfony bundle which enables the popular Select2 component to be used as a drop-in replacement for a stand

Ross Keatinge 214 Nov 21, 2022
A fast Directus docs search workflow for Alfred

Directus Docs Workflow for Alfred A fast Directus docs search workflow for Alfred. Adapted from Tailwind CSS Docs, which is adapted from Alfred VueJS

null 2 Aug 28, 2022
DropItem3D - PocketMine-MP plugin to be able to see drop items realistic.

DropItem3D - PocketMine-MP plugin to be able to see drop items realistic.

ぼい 12 Jun 2, 2022
ApiFlow is an open-source workflow engine

About apiFlow This project is built using Laravel 5.8 apiFlow is an open-source workflow engine designed to ease the implementation of business requir

Mohsen Malayeri 2 Aug 31, 2022
Easily add sub domains to your CakePHP application using route prefixes

Easily add sub domains to your CakePHP application using route prefixes. Based on code created by chinpei215.

multidimension.al 4 Feb 28, 2019