Download the PHP package protonemedia/laravel-task-runner without Composer
On this page you can find all versions of the php package protonemedia/laravel-task-runner. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download protonemedia/laravel-task-runner
More information about protonemedia/laravel-task-runner
Files in protonemedia/laravel-task-runner
Package laravel-task-runner
Short Description Write Shell scripts like Blade Components and run them locally or on a remote server
License MIT
Homepage https://github.com/protonemedia/laravel-task-runner
Informations about the package laravel-task-runner
Laravel Task Runner
A package to write Shell scripts like Blade Components and run them locally or on a remote server. Support for running tasks in the background and test assertions. Built upon the Process feature in Laravel 10.
Sponsor Us
❤️ We proudly support the community by developing Laravel packages and giving them away for free. If this package saves you time or if you're relying on it professionally, please consider sponsoring the maintenance and development and check out our latest premium package: Inertia Table. Keeping track of issues and pull requests takes time, but we're happy to help!
Installation
This package requires Laravel 10 and PHP 8.2 or higher. You can install the package via composer:
Optionally, you can publish the config file with:
Basic usage
You may use the Artisan make:task
command to create a Task
class:
This will generate two files: app/Tasks/ComposerGlobalUpdate.php
and resources/views/tasks/composer-global-update.blade.php
.
Once you've added your script to the Blade template, you may run it on your local machine by calling the dispatch()
method:
Alternatively, if you don't want a separate Blade template, you may use the --class
option (or -c
):
This allows you to specify the script inline:
Task output
The dispatch()
method returns an instance of ProcessOutput
, which can return the output and exit code:
To interact with the underlying ProcessResult
, you may call the getIlluminateResult()
method:
Script variables
Just like Blade Components, the public properties and methods of the Task class are available in the template:
Blade template:
You can create a new instance of the Task using the static make()
method:
Task options
You may specify a timeout. By default, the timeout is based on the task-runner.default_timeout
config value.
Run in background
You may run a task in the background:
It allows you to write the output to a file, as the dispatch()
method won't return anything when the Task is still running in the background.
Run tasks on a remote server
In the task-runner
configuration file, you may specify one or more remote servers:
Now you may call the onConnection()
method before calling other methods:
Task test assertions
You may call the fake()
method to prevent tasks from running and make assertions after acting:
You may also use a callback to investigate the Task further:
If you type-hint the Task with PendingTask
, you may verify the configuration:
To fake just some of the tasks, you may call the fake()
method with a class or array of classes:
Alternatively, you may fake everything except a specific task:
You may also supply a fake Task output:
Or use the ProcessOutput
class to set the exit code as well:
When you specify the Task output, you may also prevent unlisted Tasks from running:
Changelog
Please see CHANGELOG for more information what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Other Laravel packages
Inertia Table
: The Ultimate Table for Inertia.js with built-in Query Builder.Laravel Blade On Demand
: Laravel package to compile Blade templates in memory.Laravel Cross Eloquent Search
: Laravel package to search through multiple Eloquent models.Laravel Eloquent Scope as Select
: Stop duplicating your Eloquent query scopes and constraints in PHP. This package lets you re-use your query scopes and constraints by adding them as a subquery.Laravel FFMpeg
: This package provides an integration with FFmpeg for Laravel. The storage of the files is handled by Laravel's Filesystem.Laravel MinIO Testing Tools
: Run your tests against a MinIO S3 server.Laravel Mixins
: A collection of Laravel goodies.Laravel Paddle
: Paddle.com API integration for Laravel with support for webhooks/events.Laravel Verify New Email
: This package adds support for verifying new email addresses: when a user updates its email address, it won't replace the old one until the new one is verified.Laravel XSS Protection
: Laravel Middleware to protect your app against Cross-site scripting (XSS). It sanitizes request input, and it can sanatize Blade echo statements.
Security
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
Credits
- Pascal Baljet
- All Contributors
License
The MIT License (MIT). Please see License File for more information.
All versions of laravel-task-runner with dependencies
illuminate/process Version ^10.0|^11.0
spatie/laravel-package-tools Version ^1.13.0
spatie/temporary-directory Version ^2.1