Laravel Software Install Script Template/Process
Many developers find it kinda confusing at first on how to go about creating install scripts for clients or users of open source projects. This is a simple template/step-by-step process to help you accomplish that. You can fork, contribute to it or just copy the template/process into your app and improve on it based on your specific need.
It has to do with creating a custom artisan command. If you are not sure how to go about that, please check this comprehensive [blog post][1]
Stey by Step Process
Open your Terminal and Run the command:
php artisan make:console Install
This creates a file called Install.php in the app/Console/Commands directory.
Open the file Install.php and dump this:
<?php
namespace App\Console\Commands;
use DB;
use Exception;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Artisan;
class Install extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'software:install';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Install this software without issues, Thanks!';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
try {
DB::connection();
} catch (Exception $e) {
$this->error('Unable to connect to database.');
$this->error('Please fill valid database credentials into .env and rerun this
Link: