Simplify Installing and Updating your App With Laravel Executor

News

June 26th, 2020

laravel-executor-featured.png

Laravel Executor is a package by Ash Allen that simplifies running code and commands when installing or updating your web application.

This package provides “executor” classes you can run from the artisan command line. A basic example is running the following command after pulling the latest version of a project from a remote repository:

1<?php
2
3namespace App\Executor;
4
5use AshAllenDesign\LaravelExecutor\Classes\Executor;
6
7class AppUpdate extends Executor
8{
9 public function run(): Executor
10 {
11 return $this->simpleDesktopNotification('Starting Executor', 'Starting the AppUpdate Executor.')
12 ->runExternal('composer install')
13 ->runArtisan('migrate')
14 ->runArtisan('cache:clear')
15 ->completeNotification();
16 }
17}

The command would run composer installation, run artisan migrations, clear cache, and notify the user via desktop notifications.

To trigger the executor, you run artisan. Using the example above, it would look like:

1php artisan executor:app-update

Here’s a visual of running an executor via the command line as seen in the project’s readme:

If you have a scenario where you want to manually run an executor, you can use the run() method:

1(new AppInstall())->run();

Learn More

You can learn more about this package, get full installation instructions, and view the source code on GitHub at ash-jc-allen/laravel-executor.

Filed in:

Paul Redmond

Full stack web developer. Author of Lumen Programming Guide and Docker for PHP Developers.