Download the PHP package monzer/filament-workflows without Composer
On this page you can find all versions of the php package monzer/filament-workflows. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download monzer/filament-workflows
More information about monzer/filament-workflows
Files in monzer/filament-workflows
Informations about the package filament-workflows
π Filament Workflows Plugin for Laravel
β¨ Introduction
This package is a FilamentPHP plugin designed to provide a workflow automation system within FilamentPHP applications. It enables users to create and manage workflows triggered by model events, custom events, or scheduled tasks. The package integrates seamlessly with FilamentPHP, offering a Filament Resource for managing workflows.
π Features
- π Workflow automation via model events, custom events, or scheduling.
- π οΈ Filament Resource for CRUD workflow management.
- ποΈ Supports custom workflow actions.
- π Execution logs viewable through Filament.
- π Chaining of multiple actions.
- π Webhook sending as an external integration.
- β¨ Magic Attributes enable dynamic replacement of placeholders with model attributes or event data, allowing seamless data binding and automation within the system.
Screenshots
βοΈ Installation & Setup
π₯οΈ Requirements
Ensure your Laravel application meets the following requirements:
- Laravel 10+
- FilamentPHP 3.2
- PHP 8.1+
π₯ Install the Package
β‘ Publish Migration
β‘ Publish Configuration (Optional)
π Migrate Database
π§ Registering the Plugin
Users must manually register the plugin in their PanelProvider.php:
π Setting Up Model Event Workflows
To integrate a model with the model event workflow system, the model must implement the following trait:
To change the model display name you can use the getModelName() static function:
To change the attributes display name you can use the getAttributeName() static function:
NOTE:
You need to run php artisan schedule:work command to run the workflows.
π§ Configuration
Example configuration in config/workflows.php:
π Log Management
Automatic Log Rotation
Starting from version 0.3.0, this package includes automatic log rotation to prevent database overflow. By default, only the last 100 log entries are kept for each workflow.
Configuration
You can customize the maximum number of log entries by setting the WORKFLOWS_MAX_LOG_ENTRIES environment variable:
Or modify it directly in the config file:
To disable log rotation (not recommended):
Cleaning Up Existing Logs
If you have existing workflows with large log histories, you can clean them up using the provided artisan command:
Database Migration for Large Logs
For existing installations that experience database errors due to large logs, run the optional migration to increase column size:
πͺ Magic Attributes
Magic attributes are placeholders that get dynamically replaced with actual data from the model or event triggering the workflow.
π Model Event Workflows
-
@email@β Replaced by the model's email attribute.-
Example:
- If the model contains
email = [email protected], the message will be:
-
π Custom Event Workflows
-
@event->name@β Replaced by the eventβs name attribute.-
Example:
- If the event contains
name = System Update, the message will be:
-
π― Defining Custom Workflow Actions
Users can create custom actions by implementing the Action interface. Below is an example implementation of the
SendEmail** action:
Then add your custom action
π Sharing Data Between Actions
To allow actions to be aware of each other and share data, a shared data array is passed between actions in
the execute function. This enables actions to store and retrieve information dynamically as they execute.
π How It Works:
- Each action receives a shared data array.
- Actions can store values inside this array to be used by subsequent actions.
- The shared data persists throughout the workflow execution.
π Example: Sharing Data Between Actions
Let's say we need to:
1οΈβ£ Generate an Invoice and store the invoice_id.
2οΈβ£ Send an Email using that invoice_id.
π οΈ Action 1: Generate Invoice
π§ Action 2: Send Email with Invoice ID
Using workflows with tenancy
Create a middleware to setup tenancy
Then, add the middleware to the panel
π§ͺ Tests
Currently, automated tests are not available for this package. Future updates may include unit tests and integration tests to ensure workflow stability and execution accuracy.
β€οΈ Support & Contributions
For issues and feature requests, please visit the GitHub repository and create an issue.
Pull requests are welcome. Make sure to follow the contribution guidelines.
π° Support the Project
If you find this package helpful and would like to support its development, consider making a donation:
Your support helps improve and maintain this package! π
π License
This package is licensed under the MIT License. See the LICENSE file for details.