Skip to content

Artisan Commands

The starter includes several custom Artisan commands for managing your application’s database, configuration, and Northwestern integrations.

Database Commands

db:rebuild

Completely rebuild the database by dropping all tables, running migrations, and executing all auto-discovered seeders.

Terminal window
php artisan db:rebuild

What it does:

  1. Clears application cache, queue, and schedule cache
  2. Runs migrate:fresh (drops all tables and re-runs migrations)
  3. Executes all seeders via db:seed
  4. Seeds demo data via DemoSeeder
  5. Regenerates IDE model helper annotations

When to use:

  • Initial project setup
  • After pulling schema changes from git
  • When switching between feature branches with different schemas
  • Resetting test data during development

Related: db:wipe, migrate:fresh, db:seed


db:seed:list

Display all auto-discovered seeders with their dependencies and execution order.

Terminal window
php artisan db:seed:list
Options
#--show-dependenciesflag

Show full dependency tree

#--mermaidflag

Output as Mermaid diagram

#--jsonflag

Output as JSON

Output example:

┌───┬──────────────────┬──────────────────────────────────┐
│ # │ Seeder │ Dependencies │
├───┼──────────────────┼──────────────────────────────────┤
│ 1 │ PermissionSeeder │ none │
│ 2 │ RoleTypeSeeder │ none │
│ 3 │ RoleSeeder │ RoleTypeSeeder, PermissionSeeder │
└───┴──────────────────┴──────────────────────────────────┘

When to use:

  • Verify seeder discovery and dependencies
  • Troubleshoot seeding order issues
  • Document available seeders for your team

See also: Idempotent Seeding documentation


db:snapshot:create {filename?}

Create a snapshot of the current database state.

Terminal window
php artisan db:snapshot:create my-snapshot-name
Options
#filenameargument

Descriptive name for the snapshot. Defaults to database-dump if omitted.

#--skip-schema-validationflag

Skip schema validation checks

What it does:

  1. Validates database schema matches current migrations (unless skipped)
  2. Dumps database to database/snapshots/{name}.sql
  3. Stores metadata about the snapshot (checksum, timestamp, migration/seeder counts)

When to use:

  • Before making risky database changes
  • Saving a known-good state for testing
  • Creating test data fixtures
  • Preserving demo data

See also: Database Snapshots documentation


db:snapshot:restore {filename?}

Restore a previously created database snapshot.

Terminal window
php artisan db:snapshot:restore my-snapshot-name
Options
#filenameargument

Name of the snapshot to restore. Defaults to database-dump if omitted.

#--skip-schema-validationflag

Skip schema validation checks

#--backupflag

Create a backup of the current database before restoring

#--forceflag

Skip confirmation prompt

What it does:

  1. Validates snapshot exists
  2. Checks schema compatibility (unless skipped)
  3. Creates a backup if requested
  4. Drops all current database tables
  5. Restores data from snapshot SQL file

When to use:

  • Resetting to a known state during testing
  • Recovering from bad data changes during development
  • Switching between test scenarios

db:snapshot:list

List all available database snapshots.

Terminal window
php artisan db:snapshot:list

db:snapshot:info {filename?}

Display detailed information about a specific snapshot.

Terminal window
php artisan db:snapshot:info my-snapshot-name
Options
#filenameargument

Name of the snapshot to inspect. If omitted, an interactive selector is shown.

What it does:

  1. Displays file information (path, size, modification date)
  2. Shows schema metadata (checksum, migration/seeder counts)
  3. Compares snapshot schema with current codebase

When to use:

  • Verifying a snapshot’s contents before restoring
  • Checking if a snapshot is compatible with current code
  • Reviewing snapshot metadata

db:snapshot:delete {filename?}

Delete a database snapshot and its associated metadata.

Terminal window
php artisan db:snapshot:delete my-snapshot-name
Options
#filenameargument

Name of the snapshot to delete. If omitted, an interactive selector is shown.

#--allflag

Delete all snapshots

What it does:

  1. Removes the SQL snapshot file from database/snapshots/
  2. Cleans up associated metadata from the checksum map

When to use:

  • Removing old or unused snapshots
  • Freeing up disk space
  • Cleaning up after testing

db:wake

Wake up a potentially-inactive serverless RDS database by establishing a connection.

Terminal window
php artisan db:wake
Options
#--max-attemptsoption5

Maximum number of connection attempts (1-20)

#--delayoption5

Seconds to wait between attempts (1-30)

What it does:

Attempts to connect to the database and execute a simple query, causing serverless databases (like AWS Aurora Serverless) to wake from sleep mode.

When to use:

  • Before running migrations
  • As part of deployment scripts
  • When you know the database has been idle

Configuration Commands

config:validate

Validate application configuration and environment variables.

Terminal window
php artisan config:validate

What it does:

Runs all auto-discovered config validators and reports their status. Built-in validators check:

  • Application key
  • SSO credentials (Entra ID or Online Passport)
  • Directory Search API key
  • Database connectivity
  • Queue connection
  • S3 storage access
  • EventHub credentials (when not mocked)

Validators that aren’t relevant to the current configuration (e.g., EventHub when mocked) are automatically skipped and shown separately in the output.

When to use:

  • After initial installation
  • After environment variable changes
  • Before deployment
  • Troubleshooting integration issues

Adding Custom Validators

Validators are discovered automatically using the #[StarterValidator] attribute, following the same pattern as #[AutoSeed] for seeders.

1. Create a validator class implementing ConfigValidator in a Services/ConfigValidation directory within your domain:

<?php
namespace App\Domains\Billing\Services\ConfigValidation;
use App\Domains\Core\Attributes\StarterValidator;
use App\Domains\Core\Contracts\ConfigValidator;
#[StarterValidator(description: 'Stripe')]
class StripeValidator implements ConfigValidator
{
public function shouldRun(): bool
{
// Return false to skip when the integration isn't configured
return filled(config('services.stripe.secret'));
}
public function validate(): bool
{
return filled(config('services.stripe.secret'))
&& filled(config('services.stripe.key'));
}
public function successMessage(): string
{
return 'Stripe API keys are configured';
}
public function errorMessage(): string
{
return 'Stripe configuration is incomplete';
}
public function hints(): array
{
return [
'Set <comment>STRIPE_KEY</comment> and <comment>STRIPE_SECRET</comment> in your .env file',
];
}
}

2. That’s it. The validator is automatically discovered from any app/Domains/*/Services/ConfigValidation directory. No registration or configuration needed.


Maintenance Commands

access-tokens:notify-expiration

Send expiration reminder emails for access tokens approaching their expiration date.

Terminal window
php artisan access-tokens:notify-expiration

What it does:

  1. Queries for active access tokens with upcoming expiration dates
  2. Checks which tokens are due for notifications (30, 14, 7, 3, 1 days before)
  3. Sends reminder emails to token owners

See also: API Documentation


Health Check Commands

health:check

Run health checks for all external integrations and services.

Terminal window
php artisan health:check

What it does:

Validates connectivity and configuration for:

  • Database - Connection and query execution (production only)
  • Queue - Queue worker connectivity
  • Cache - Cache store read/write
  • Schedule - Scheduler heartbeat
  • Debug Mode - Ensures debug mode is off (non-local)
  • Optimized App - Ensures app is optimized (non-local)
  • Security Advisories - Checks for known package vulnerabilities
  • Redis - Redis connectivity (when Redis driver is in use)
  • Directory Search - API connectivity and test query

When to use:

  • After deployment
  • Troubleshooting integration issues
  • Monitoring service connectivity
  • As part of CI/CD pipelines

Integration:

The /api/health endpoint also runs these checks for automated monitoring:

Terminal window
curl -H "X-Secret-Token: your-secret-token" https://your-app.northwestern.edu/api/health

Starter Commands

starter:check

Check for newer releases of the Northwestern Laravel Starter.

Terminal window
php artisan starter:check

What it does:

  1. Reads the current version from .starter-version.yaml
  2. Queries the GitHub Releases API for newer versions
  3. Displays release notes and a compare URL for any available updates
Options
#--version-fileoption

Path to .starter-version.yaml (defaults to project root)

This command runs automatically via composer install and composer update in local environments. Results are cached for 4 hours to avoid unnecessary API calls.


Changelog Commands

make:changelog

Scaffold a new changelog Markdown file in resources/changelogs/.

Terminal window
php artisan make:changelog

In interactive mode, the command prompts for a slug, date, and title with sensible defaults. Arguments and options can also be passed directly:

Terminal window
php artisan make:changelog 2026-03-01 --date=2026-03-01 --title="Search Improvements"
Options
#slugargument

URL-safe identifier. Defaults to today’s date.

#--dateoption

Authored date in YYYY-MM-DD format. Defaults to today.

#--titleoption

Human-readable title. Defaults to “Month Year Release” when the slug is a date.

If a file with the same slug already exists, a numeric suffix is appended automatically.

See also: Changelog documentation


IDE Helper Commands

The starter uses laravel-ide-helper to generate IDE autocomplete files. These commands are automatically run after db:rebuild:

ide-helper:generate

Generate IDE helper file for Laravel facades.

Terminal window
php artisan ide-helper:generate

ide-helper:models

Generate PHPDoc annotations for Eloquent models.

Terminal window
php artisan ide-helper:models --write --reset

ide-helper:meta

Generate PhpStorm meta file for container bindings.

Terminal window
php artisan ide-helper:meta