toneflix-code / laravel-visualconsole
A Laravel package to help with frequent artisan tasks and more.
Installs: 50
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
Language:Blade
Requires
- php: ^8.0|^8.1|^8.2
- illuminate/filesystem: ^8.0|^9.0|^10.0|^11.0
- illuminate/support: ^8.0|^9.0|^10.0|^11.0
- masbug/flysystem-google-drive-ext: ^2.3
- rap2hpoutre/laravel-log-viewer: ^2.2
- spatie/laravel-slack-alerts: ^1.3|^1.4
- winter/laravel-config-writer: ^1.1
- zanysoft/laravel-zip: ^2.0
Requires (Dev)
- orchestra/testbench: ^6.0|^8.20
- phpunit/phpunit: ^9.0|^10.1
README
Laravel Visual Console is designed to give you a visual experience of your most frequent Laravel processes, artisan commands, and system management. This could come in really handy if you build and manage APIs that don't require you to build any additional user interfaces.
Installation
You can install the package via composer:
composer require toneflix-code/laravel-visualconsole
Post Installation
After installation you must publish the package assets by running:
php artisan vendor:publish --tag=visualconsole-assets
Optionally you can publish the configuration file by running:
php artisan vendor:publish --tag=visualconsole-config
You can also optionally publish the views by running:
php artisan vendor:publish --tag=visualconsole-view
If needed, you can also publish the routes by running:
php artisan vendor:publish --tag=visualconsole-routes
Getting Google Keys
This package depends on google drive for backup storage, although you can use any storage your spp is configured to run with.
Please follow Google Docs to obtain your client ID, client secret & refresh token
which is required to get the system running.
In addition you can also check these easy-to-follow tutorial by @ivanvermeyen
Usage
After installation, the package is ready to use, simply point your browser to http://youdomainexample.com/system/console/login.
The default setup is configured to work with your current authentication model.
Authorization
By default, the package will check the privileges
field of the current authentication model [User]
for if the authenticating user has the admin
Privilege assuming the value of the field is a numeric list of attributes/privileges, if it fails to confirm it checks if the value of the field is exactly admin
, once confirmed the user is authenticated.
If you which to change the behaviour you should check the Post Installation section for how to publish the config and modify it to suit your requirements, you can also set the permission_field
and permission_value
config values to null
in order to disable this behaviour. Disabling the feature implies that anyone with log in access can also access the visual console.
Custom Commands
The library also exposes a few custom Artisan commands to help you with certain everyday tasks, even though these commandsa are accessible through the UI, they are still Artisan commands and are as much accessible through your terminal.
-
system:deploy
: Automatically deploys the latest code from the git repository associated with your project. Before you run this command, make sure you have set up a git repository and have added a remote named "origin".-
ARGUMENTS
--branch=
: The branch to deploy, the default ismain
.--force
: Force the deployment.--dev
: Run in development mode (This will prevent composer from removing dev dependencies)--log-level=[level]
: How log the output should handled.0
= none,1
= console only,2
= file and console.--mock-php
: If your server is on a shared hosting which uses a different version on the CLI less that php 8.1, this option allows you to use a different version of php of your choice, publish the config file and update thephp_bin
option or setVISUALCONSOLE_PHP_BINARY
option on your .env file (Make sure the path is an abosolute path to your prefered php binary). You can also set thecomposer
option or set theVISUALCONSOLE_COMPOSER
option on your .env.--composer=[command]
Allows you to run a custom composer command, this is useful if you want to run a composer command before the deployment. E.g.--composer="install --no-dev"
. For now this option only supports theinstall
andupdate
commands only.--ensure-commit
: Make sure there are no uncommitted changes before deployment.
Example:
php artisan system:deploy --branch=main
-
-
system:control
: Helps you perforom common system tasks like backup, backup restore and system reset.-
PARAMETERS
action
The specific action to carryout [reset, backup, restore]
-
ARGUMENTS
--w|wizard
: Let the wizard guide you through the whole process.--r|restore
: Restore the system to the last backup or provide the--signature
option to restore to a known backup signature.--s|signature=
: Set the backup signature value to restore a particular known backup. E.g.2022-04-26_16-05-34
.--b|backup
: During system reset, do a complete system backup before the reset.--d|delete
: If the restore option is set, this option will delete the backup files after successfull a restore.--f|force
: Force the action to execute.
Example:
php artisan system:control backup --w|wizard
-
-
system:key-gen
: Generate a webhook secret key for the application, you can use this key for authorizing github or any other services where you need access tho the artisan webhook interface.Example:
php artisan system:key-gen
Artisan Webhook Interface
The Artisan Webhook Interface allows you to remotely run any of the given artisan commands listed above where user authentication is not possible.
The interface can be accessed like this: http://youdomainexample.com/system/webhooks/artisan/[command [--param1] [--param2]]
.
When accessing this endpoint, you will have to pass the HMAC hex digest of the request body, generated using the SHA-1 or SHA-256 hash function and the secret as the HMAC key through the X-Hub-Signature
header for Github or the X-Signature
for other services, provided for convinience purpose.
Queues and Failed Jobs
The library currently supports the database connection for queued jobs.
Testing
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security-related issues, please email code@toneflix.com.ng instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.