PHPackages                             safemood/laravel-workflow - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. safemood/laravel-workflow

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

safemood/laravel-workflow
=========================

Laravel package that simplifies workflows with clear actions definition and event tracking.

1.2.0(1y ago)2061.6k↓50%8[1 PRs](https://github.com/Safemood/laravel-workflow/pulls)MITPHPPHP ^8.2CI passing

Since Jul 14Pushed 1mo ago3 watchersCompare

[ Source](https://github.com/Safemood/laravel-workflow)[ Packagist](https://packagist.org/packages/safemood/laravel-workflow)[ Docs](https://github.com/safemood/laravel-workflow)[ GitHub Sponsors](https://github.com/Safemood)[ RSS](/packages/safemood-laravel-workflow/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (7)Dependencies (13)Versions (11)Used By (0)

Laravel Workflow
================

[](#laravel-workflow)

[![Latest Version on Packagist](https://camo.githubusercontent.com/8c8ac26341e1885191314d2c9289e893cbd3acf555d9682a2b7767a7ac687da4/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f736166656d6f6f642f6c61726176656c2d776f726b666c6f773f7374796c653d666c61742d73717561726526636f6c6f723d626c7565)](https://packagist.org/packages/safemood/laravel-workflow)[![GitHub Tests Action Status](https://camo.githubusercontent.com/b16ee30cb382b724c068dbdeb16ebaf1b1a2a54dc3075ee60d50c1774dc549f8/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f736166656d6f6f642f6c61726176656c2d776f726b666c6f772f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/safemood/laravel-workflow/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/6dbaa4391760a929061e0511f3346189d807e4a3b17635ce98cce24d9a231ea6/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f736166656d6f6f642f6c61726176656c2d776f726b666c6f772f6669782d7068702d636f64652d7374796c652d6973737565732e796d6c3f6272616e63683d6d61696e266c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/safemood/laravel-workflow/actions?query=workflow%3A%22Fix+PHP+code+style+issues%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/0574851edb01ec0e59619c040ebd58ef3a27eed512b3e7b5e06893b63d9b24f7/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f736166656d6f6f642f6c61726176656c2d776f726b666c6f772e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/safemood/laravel-workflow)

Laravel Workflow combines feature details into one class, allowing for action definition and event tracking, simplifying understanding and revealing hidden logic.

- [Laravel Workflow](#laravel-workflow)
    - [Installation](#installation)
    - [Create a Workflow](#create-a-workflow)
    - [Create Actions](#create-actions)
    - [Basic Example](#basic-example)
        - [Define Workflow Logic](#define-workflow-logic)
        - [Execute Workflow](#execute-workflow)
    - [Conditional Action Execution](#conditional-action-execution)
    - [Using DTO for Context](#using-dto-for-context)

Installation
------------

[](#installation)

You can install the package via Composer:

```
composer require safemood/laravel-workflow
```

Create a Workflow
-----------------

[](#create-a-workflow)

You can create a workflow using the artisan command:

```
php artisan make:workflow PaymentWorkflow
```

Create Actions
--------------

[](#create-actions)

You can create an action using the artisan command:

```
php artisan make:workflow-action ValidateCartItems
```

```
