CLI Commands
Framework and guided-learning command reference
DALT.PHP Artisan has two command groups:
- Core commands: always available
- Guided-learning commands: available only when
.daltis installed
Use this to check mode:
php artisan platform:statusGetting Help
View all available commands:
php artisan helpCore Commands
These work in both core and guided-learning experiences.
Development
serve
Start the PHP development server.
php artisan serve [host] [port]Default: 127.0.0.1:8000
Examples:
# Start on default port 8000
php artisan serve
# Start on custom port
php artisan serve 127.0.0.1 8080
# Make accessible from network
php artisan serve 0.0.0.0 8000If the specified port is in use, Artisan automatically finds the next available port.
What it does:
This command starts PHP's built-in web server and immediately begins serving files from the public/ directory explicitly routing requests through public/router.php. It also enables hot-reloading for rapid development, freeing you from manual restarts.
dev (guided learning)
Start both PHP and Vite development servers simultaneously.
php artisan devWhat it does: When running in guided learning mode, this command seamlessly starts both the PHP server on port 8000 and the Vite development server on port 5173. By running these servers in parallel, it automatically enables hot module replacement (HMR) for your entire frontend.
Guided-learning command. Requires .dalt and Node.js dependencies.
Press Ctrl+C to stop both servers.
Database Commands
migrate
Run all pending database migrations.
php artisan migrateWhat it does:
Running this command scans your database/migrations/ directory and executes any .sql files chronologically. The framework strictly tracks executed migrations inside a migrations table, guaranteeing that past migrations are safely skipped.
Output example:
Running migration: 20240315120000_create_users_table.sql
✓ Success
Running migration: 20240315130000_create_posts_table.sql
✓ Success
Ran 2 migrations.Migrations are idempotent - safe to run multiple times.
migrate:fresh
Drop the database and run all migrations from scratch.
php artisan migrate:freshWARNING: This deletes ALL data! Only use in development.
What it does: This command completely deletes your current SQLite database file and reconstructs the database from scratch. All tables and migration tracking are reset, allowing all structural migrations to sequentially execute cleanly.
Use cases:
- Starting fresh during development
- Resetting test data
- Fixing migration conflicts
make:migration
Create a new SQL migration file.
php artisan make:migration <name>Examples:
# Create posts table migration
php artisan make:migration create_posts_table
# Create users table migration
php artisan make:migration create_users_table
# Add column migration
php artisan make:migration add_status_to_postsGenerated file:
database/migrations/20240315120000_create_posts_table.sqlTemplate content:
-- Migration: create_posts_table
-- Created: 2024-03-15 12:00:00
CREATE TABLE IF NOT EXISTS posts (
id INTEGER PRIMARY KEY AUTOINCREMENT,
name VARCHAR(255) NOT NULL,
created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
updated_at DATETIME DEFAULT CURRENT_TIMESTAMP
);
-- Add indexes here
-- CREATE INDEX IF NOT EXISTS idx_posts_name ON posts(name);
-- Notes:
-- SQLite: INTEGER PRIMARY KEY AUTOINCREMENT
-- MySQL: INT AUTO_INCREMENT PRIMARY KEY
-- PostgreSQL: SERIAL PRIMARY KEYNext steps:
- Edit the generated file
- Customize table structure
- Run
php artisan migrate
Testing
test
Run the Pest test suite.
php artisan testWhat it does:
Running this command launches the integrated Pest PHP testing framework across your tests/ directory. Results are color-coded in your terminal, and coverage guarantees are visually reported if properly configured.
Requires Pest installed: composer require pestphp/pest --dev
Output example:
PASS Tests\Feature\RoutingTest
✓ homepage loads successfully
✓ posts index shows all posts
✓ single post shows correct data
Tests: 3 passed
Time: 0.12sGuided-Learning Commands
These commands are available only when .dalt exists.
challenge:list
List all available challenges with difficulty and pass status.
php artisan challenge:listchallenge:start
Load broken files for a challenge into your app (with confirmation).
php artisan challenge:start <challenge-name>Available challenges:
broken-routingbroken-middlewarebroken-authbroken-databasebroken-session
Example:
php artisan challenge:start broken-routingchallenge:verify
Verify your fix against the active challenge (checks the real app).
php artisan challenge:verifyRun php artisan challenge:start <name> first to load a challenge, then challenge:verify to check your fix.
challenge:reset
Reset to the buggy baseline for a fresh start on the active challenge.
php artisan challenge:resetchallenge:stop
Stop the active challenge and restore your clean app.
php artisan challenge:stopOutput:
╔══════════════════════════════════════════════════════════════╗
║ DALT Challenge Verification System ║
╚══════════════════════════════════════════════════════════════╝
Verifying: broken-routing
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✓ Route get /posts/create exists
✓ Route get /posts/{id}/edit exists
✓ Route order correct: specific before generic
✓ No problematic code found
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Results: 4/4 tests passed
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✅ All tests passed! Challenge complete!What challenge:verify does:
- Runs automated tests for the active challenge
- Checks for specific bugs and fixes
- Provides hints if tests fail
- Logs results to
storage/logs/challenges.log
Exit codes:
0- All tests passed1- Some tests failed
platform:status
Show current mode (guided learning installed or core-only).
php artisan platform:statusplatform:clean
Remove the guided learning layer (.dalt) and keep the framework core.
php artisan platform:cleanplatform:remove remains as a compatibility alias.
Example Commands
example:install
Install pre-built example code.
php artisan example:install <example-name>Available examples:
auth- Complete authentication system
Example:
php artisan example:install authWhat it does:
This strictly copies pre-built controller files into your app/Http/controllers/ folder and associated view files into the resources/views/ folder. It will then automatically append the corresponding routing logic directly into your app's routes.php file and safely mark the installation complete.
Installed files:
app/Http/controllers/
├── session/
│ ├── create.php (login form)
│ ├── store.php (login handler)
│ └── destroy.php (logout)
└── registration/
├── create.php (register form)
└── store.php (register handler)
resources/views/auth/
├── login.view.php
└── register.view.phpAdded routes:
$router->get('/register', 'registration/create.php')->only('guest');
$router->post('/register', 'registration/store.php')->only(['guest','csrf']);
$router->get('/login', 'session/create.php')->only('guest');
$router->post('/session', 'session/store.php')->only(['guest','csrf']);
$router->delete('/session', 'session/destroy.php')->only(['auth','csrf']);After installation, visit /register or /login to use the auth system.
Command Reference
Quick Reference Table
| Command | Purpose | Example |
|---|---|---|
serve | Start dev server | php artisan serve |
dev | Start PHP + Vite | php artisan dev |
migrate | Run migrations | php artisan migrate |
migrate:fresh | Reset database | php artisan migrate:fresh |
make:migration | Create migration | php artisan make:migration create_posts |
test | Run tests | php artisan test |
challenge:list | List challenges | php artisan challenge:list |
challenge:start | Load challenge | php artisan challenge:start broken-routing |
challenge:verify | Verify fix | php artisan challenge:verify |
challenge:reset | Reset to buggy | php artisan challenge:reset |
challenge:stop | Stop challenge | php artisan challenge:stop |
platform:status | Show current mode | php artisan platform:status |
platform:clean | Remove guided learning | php artisan platform:clean |
example:install | Install example | php artisan example:install auth |
help | Show help | php artisan help |
Common Workflows
Starting Development
# Terminal 1: Start servers
php artisan serve
# Terminal 2 (optional): start frontend HMR when using guided learning
php artisan devDatabase Setup
# Create migration
php artisan make:migration create_posts_table
# Edit: database/migrations/TIMESTAMP_create_posts_table.sql
# Run migration
php artisan migrateWorking on Challenges
# Start a challenge (loads broken files)
php artisan challenge:start broken-routing
# Fix the bugs...
# Verify solution
php artisan challenge:verifyFresh Start
# Reset database
php artisan migrate:fresh
# Clear logs
rm storage/logs/*.log
# Restart server
php artisan serveTroubleshooting
Port Already in Use
If you see "Address already in use":
# Use different port
php artisan serve 127.0.0.1 8080
# Or kill existing process
lsof -ti:8000 | xargs kill -9Migration Errors
If migrations fail:
# Check migration syntax
cat database/migrations/TIMESTAMP_file.sql
# Reset and try again
php artisan migrate:freshVite Not Starting
If php artisan dev fails:
# Confirm guided-learning mode
php artisan platform:status
# Reinstall dependencies from project root
npm install
# Try again
php artisan devPermission Errors
If you see permission denied:
# Make artisan executable
chmod +x artisan
# Fix storage permissions
chmod -R 775 storage
chmod -R 775 databaseAdvanced Usage
Custom Server Configuration
# Bind to all interfaces
php artisan serve 0.0.0.0 8000
# Use specific PHP version
/usr/bin/php8.2 artisan serveRunning Specific Tests
# Run specific test file
vendor/bin/pest tests/Feature/RoutingTest.php
# Run with coverage
vendor/bin/pest --coverageMigration Management
# Check migration status
sqlite3 database/app.sqlite "SELECT * FROM migrations;"
# Manually mark migration as run
sqlite3 database/app.sqlite "INSERT INTO migrations (migration) VALUES ('20240315_file.sql');"Environment Variables
Some commands respect environment variables:
# Use different database
DB_DATABASE=database/test.sqlite php artisan migrate
# Enable debug mode
APP_DEBUG=true php artisan serveNext Steps
- Configuration - Configure your application
- Verification System - How challenge verification works
- Building a Blog - Use these commands in practice