nguyenhiep/laravel-web-artisan

This package allows you to execute artisan commands in a simple way using the browser window. If you don't have SSH access to the hosting platform where your Laravel site is hosted, this solution allows you to run commands like "php artisan migrate".

Installs: 6

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 3

Language:Blade

Type:package

v1.1.2 2021-01-19 09:27 UTC

This package is auto-updated.

Last update: 2024-04-19 17:23:33 UTC


README

Laravel Web Artisan

Latest Version on Packagist Software License Quality Score Total Downloads

This package allows you to execute Artisan commands in a simple way using the browser window. If you don't have SSH access to the hosting platform where your Laravel site is hosted, this solution allows you to run commands like "php artisan migrate" in a virtual shell on the browser.

This package requires Laravel 5.8 or higher.

Preview

Installation

Require this package with Composer on your Laravel project.

$composer require nguyenhiep/laravel-web-artisan

Laravel uses Package Auto-Discovery, so you don't need to manually add the ServiceProvider.

Adding this to $middleware into Kernel.php

protected $middleware = [
        //...
        \Illuminate\Session\Middleware\StartSession::class,
        \Illuminate\View\Middleware\ShareErrorsFromSession::class,
];

The Web Artisan window will be enabled when WEBARTISAN_ENABLED is true, on your .env project file.
The following line must be added in the .env file of your Laravel project to enable the Web Artisan window, otherwise it is disabled by default.

WEBARTISAN_ENABLED=true

By default Laravel Web Artisan needs an authentication before you can run commands into the window terminal.

We recommend to always use authentication to prevent commands from being executed by anyone when the window is enabled.

WEBARTISAN_USERNAME=myusername
WEBARTISAN_PASSWORD=mypassword

If you want to use Web Artisan without authentication you can change use_authentication to false in the config/webartisan.php config file.

In this case, you should publish the config/webartisan.php config file with:

php artisan vendor:publish --provider="Micheledamo\LaravelWebArtisan\LaravelWebArtisanServiceProvider"

and than you can edit it.

Usage

Simply, in any page of your site, if the Web Artisan is enabled, you will see a terminal window appear at the bottom of the page.
Authenticate yourself with the credentials set in the .env file, if you use Web Artisan with authentication, and run any type of Artisan command, even custom ones, as in a terminal shell: et voilà, the magic!

Usage example

Change log

Please see CHANGELOG for more information on what has changed recently.

Credits

License

The MIT License (MIT). Please see License File for more information.