Download the PHP package ibrostudio/laravel-piped-tasks without Composer
On this page you can find all versions of the php package ibrostudio/laravel-piped-tasks. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download ibrostudio/laravel-piped-tasks
More information about ibrostudio/laravel-piped-tasks
Files in ibrostudio/laravel-piped-tasks
Package laravel-piped-tasks
Short Description Manage tasks workflows through Laravel Pipes
License MIT
Homepage https://github.com/ibrostudio/laravel-piped-tasks
Informations about the package laravel-piped-tasks
Laravel Piped Tasks
Manage tasks workflows through Laravel Pipes.
Concept
A process defines the order of tasks executed through a pipe.
Each process is associated with a payload. Payload is a mutable object passed to each task to retrieve, add, or update data.
Each steps of a process can be loggued through Spatie laravel-activitylog.
You can use external tasks inside a process with the Resumable feature.
Installation
Install the package via composer:
Then create the tables:
Usage
1. Create process
First you need to generate a process:
Name your process like this : \
Note: It is possible to generate processes and tasks for a package.
2. Define Payload
You'll find the associated payload to your process in App\Processes\Payloads
and its interface in App\Processes\Payloads\Contracts
.
Add properties and methods according to your workflow:
For reusability, methods can be shared by payloads by placing them in traits:
3. Create tasks
Generate your tasks with this command:
Name your process like this : \
For convenience and reusability, tasks use actions (from Spatie's Laravel Queuable Action):
4. Add tasks to the process
Under the hood, process uses Michael Rubel's Laravel Enhanced Pipeline and supports all features from it like DB transaction or events:
5. Execute process
Argument passed to the process
static method is an array used to build the Payload.
Processable models
You can link processes to any Eloquent model implementing the Processable
interface and using the IsProcessable
trait:
It allows to call process from the model:
And permits to access to the model in tasks:
Adding processable during process
If the processable model is created during a process, you can assign it to the process in a task:
Pause and resume processes
Sometimes an external task needs to be performed to complete a process. You can include it in your workflow by using PauseProcess
and the resumeUrl
:
- Define a task in your process where you want to make your external call :
The $process->resumeUrl()
method returns a Laravel signed url.
Process logs
To enable process logs, set log_processes
key to true
in config/piped-tasks.php.
Spatie laravel-activitylog methods are available to retrieve logs:
By default, the Process name is used to name the log but you can customize it by adding $logName
property to the Process:
Append / prepend tasks
Via the tasks array in the config file piped-tasks.php, it is possible to add tasks to a process. It allows you to dynamically modify a process using to the Config::set() method:
First, publish the config file:
Add your process class and append or prepend your(s) task(s) class(es):
Testing
License
The MIT License (MIT). Please see License File for more information.
All versions of laravel-piped-tasks with dependencies
filament/support Version ^3.2
ibrostudio/laravel-prompts-path-select Version ^1.0
illuminate/contracts Version ^11.0
laravel/prompts Version ^0.3.0
michael-rubel/laravel-enhanced-pipeline Version ^4.0
spatie/laravel-activitylog Version ^4.8
spatie/laravel-data Version ^4.10
spatie/laravel-package-tools Version ^1.14.0
spatie/laravel-queueable-action Version ^2.14