andrey-helldar/laravel-actions
Laravel Actions lets you encapsulate business logic in reusable action classes and run them as controllers, jobs, listeners, or console commands. With an expressive API and Laravel-friendly conventions, it keeps applications cleaner, more testable, and free of duplicated code.
Release 7.3.0 is additive: no breaking changes are called out. Existing operation dispatch code should keep working, but queued-operation behavior is now more configurable.
Minimal steps:
composer update
php artisan test
php artisan vendor:publish --tag=config
Look first at the package’s queue section, especially queue.job and the new uniqueness-lock duration setting.php artisan queue:work --queue=default
GenerateReport::dispatch($user)->onQueue('reports');
First use case: dispatch an operation as a queued job and use the new uniqueness lock duration to prevent duplicate queued work for the same logical operation.
Use the package’s dispatch API as normal, then place slower operations on dedicated queues:
GenerateReport::dispatch($user)
->onQueue('reports');
Run a worker for that queue:
php artisan queue:work --queue=reports
This keeps latency-sensitive HTTP requests fast while preserving the package’s operation conventions.
The new configurable uniqueness lock duration is useful when the same operation can be dispatched more than once, e.g. double-clicks, retries, or overlapping scheduled jobs.
Set the lock duration in the package queue config to a value that is:
Make sure the operation’s uniqueness key includes the right identifiers, such as user ID, tenant ID, and report type. Avoid a global lock unless you truly want one operation across the whole application.
Use queue.job when you need custom job behavior without forking the package:
// config/<package>.php
'queue' => [
'job' => App\Jobs\Operations\PackageOperationJob::class,
],
Your custom job should preserve the package’s expected constructor/contract and extend or mimic the default job. Common reasons to override:
$tries, $timeout, $backoff, or retryUntil().Example:
namespace App\Jobs\Operations;
use Vendor\Package\Jobs\OperationJob;
class PackageOperationJob extends OperationJob
{
public $tries = 5;
public $timeout = 120;
public function backoff(): array
{
return [10, 30, 60];
}
public function middleware(): array
{
return [
new \Illuminate\Queue\Middleware\WithoutOverlapping($this->operationKey()),
];
}
}
Keep the parent job’s constructor signature intact unless you also control every dispatch path.
--isolated from CLI wrappersThe --isolated fix aligns the package with Laravel core presence semantics. If you have an Artisan command that dispatches an operation, treat --isolated as a flag:
php artisan operations:run generate-report --isolated
Do not require --isolated=1; the option should now be detected when present in the same way Laravel core options are detected.
For fast tests:
Queue::fake();
GenerateReport::dispatch($user);
Queue::assertPushed(GenerateReportJob::class);
For integration tests, use the sync queue driver but set short lock durations so uniqueness state does not leak between tests. Clear the cache store used by the package between tests if uniqueness is cache-backed.
config:clear after config changes. If you use config:cache, changing queue.job or the uniqueness lock duration will not take effect until the config cache is rebuilt.queue.job, verify the package still receives the payload it expects. Run queued-operation tests against the custom job class.php artisan queue:restart
--isolated with queue uniqueness. --isolated controls command-level presence/behavior; uniqueness locking controls duplicate queued operation dispatch. Use both deliberately, not interchangeably.php artisan queue:failed, Horizon, or your monitoring tool. The new lock-duration setting can hide repeated dispatch attempts, so make sure failures are still visible through logs and failed-job records.--isolated parsing should add a focused regression test.How can I help you explore Laravel packages today?