PHP code example of alwayscurious / laravel-project-devtool
1. Go to this page and download the library: Download alwayscurious/laravel-project-devtool library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
alwayscurious / laravel-project-devtool example snippets
namespace App\Listeners;
use AlwaysCurious\LaravelProjectDevtool\Events\DatabaseSeeded;
class BuildDemoData
{
public function handle(DatabaseSeeded $event): void
{
// Respect a simulation: announce intent, change nothing.
if ($event->dryRun) {
$event->command->line(' [dry-run] would seed demo content');
return;
}
$event->command->info('Seeding demo content…');
$event->command->call('db:seed', [
'--class' => \Database\Seeders\DemoSeeder::class,
'--force' => true,
]);
}
}
namespace App\Listeners;
use AlwaysCurious\LaravelProjectDevtool\Events\AbortSetup;
use AlwaysCurious\LaravelProjectDevtool\Events\SetupStarting;
class EnsureSuperAdminPassword
{
public function handle(SetupStarting $event): void
{
if (empty(env('SUPER_ADMIN_PASSWORD'))) {
throw new AbortSetup('SUPER_ADMIN_PASSWORD is not set — refusing to reset.');
}
}
}
bash
php artisan project:dev # prints available actions, does nothing destructive
php artisan project:dev --setup # the full reset, with a confirmation prompt