Artisan Commands
Complete reference for Laravel Artisan console commands.
php artisan node
Execute a JavaScript file or start a REPL session with Node.js runtime.
Runs JavaScript outside the browser. Without arguments, starts an interactive REPL. --inspect enables the Node.js debugger for debugging with Chrome DevTools. --watch auto-restarts on file changes (Node 18+).
php artisan node --inspect
Run Node.js with the V8 inspector for debugging with Chrome DevTools.
Enables the debugger protocol on the specified port (default 9229). Open chrome://inspect in Chrome to connect. Allows setting breakpoints, stepping through code, and inspecting variables. --inspect-brk pauses on first line.
php artisan php artisan about
Display summary information about the application and environment.
Shows Laravel version, PHP version, database driver, cache driver, queue driver, session driver, and other environment details. Useful for quickly inspecting the application configuration.
php artisan php artisan env
Display the current environment name.
Shows the value of APP_ENV from the .env file (local, production, testing). Quick way to verify which environment you're working in without checking the .env file.
php artisan php artisan optimize
Cache the bootstrap files for faster application loading.
Caches the service provider class map and other bootstrap files. Run in production after deploying. Improves application boot time by pre-loading class maps.
php artisan php artisan optimize:clear
Remove all cached bootstrap files (config, routes, views, events, and compiled).
Clears config, route, view, event, and compiled caches in one command. Essential during development and after deploying code changes. Safe in production.
php artisan php artisan pail
Stream application logs in real-time from the terminal.
Tails the application log file and displays new entries in real-time. --filter narrows by log message content. --level shows only messages at or above the specified level (debug, info, warning, error).
php artisan php artisan schedule:list
Display all scheduled tasks with their frequency and next run time.
Shows a formatted table of all scheduled commands, their expression, and when they will next run. Useful for verifying your schedule configuration without reading the code.
php artisan php artisan telescope:clear
Delete all Telescope data from the database.
Clears all Telescope entries (requests, exceptions, logs, queries, etc). Useful to free up database space or reset the debugging dashboard. Safe to run in production.
php artisan php artisan tinker
Launch the REPL (Read-Eval-Print Loop) for interacting with the application.
Opens an interactive shell with the full Laravel application context loaded. Execute PHP code, test Eloquent queries, debug issues, and manipulate data. Exit with Ctrl+D or exit.
php artisan npm audit
Scan dependencies for known security vulnerabilities and suggest fixes.
Checks installed packages against the npm advisory database. Reports vulnerabilities by severity (low, moderate, high, critical). --fix attempts to automatically fix issues. Review fixes carefully as they may introduce breaking changes.
php artisan npm ci
Clean install based on package-lock.json for deterministic, reproducible builds.
Faster and more reliable than npm install for CI/CD. Removes node_modules/ and installs exactly what package-lock.json specifies. Never modifies package-lock.json. Use this in deployment pipelines and CI.
php artisan npm install
Install all dependencies listed in package.json into the node_modules directory.
Reads package.json and installs all dependencies. Without a package name, installs everything. --save-dev saves as devDependency. Creates node_modules/ and package-lock.json. Use npm ci in CI/CD for reproducible installs.
php artisan npm run build
Build production-optimized assets using Vite (or webpack).
Compiles, minifies, and bundles assets for production. Generates hashed filenames for cache busting. Output goes to public/build/ (Laravel default). Run after deploying code changes.
php artisan npm run dev
Start the Vite development server with hot module replacement (HMR).
Runs the "dev" script from package.json, which typically starts Vite. Provides instant feedback on code changes without full page reloads. Works with Laravel, React, Vue, and other Vite-compatible projects.
php artisan npm run watch
Watch for file changes and automatically rebuild assets on every change.
Continuously monitors files and rebuilds when changes are detected. Useful during development when using server-rendered templates (Blade) instead of Vite dev server. Press Ctrl+C to stop.
php artisan npx create-next-app
Scaffold a new Next.js application with TypeScript, Tailwind CSS, and App Router.
Creates a new Next.js project with TypeScript, ESLint, Tailwind CSS, and the App Router. Includes src/ directory structure by default. Supports --tsr, --src-dir, and --import-alias flags for customization.
php artisan npx create-react-app
Scaffold a new React application with a pre-configured build setup.
Creates a new React project with webpack, Babel, ESLint, and testing pre-configured. The --template flag supports typescript, redux, and other variants. For new projects, consider using Vite with React template instead (faster).
php artisan npx next build
Create an optimized production build of your Next.js application.
Generates an optimized production build with automatic code splitting, static generation (SSG), and server-side rendering (SSR) pages. Output goes to .next/ directory. Use next start to serve.
php artisan npx next dev
Start the Next.js development server with automatic compilation and routing.
Starts Next.js dev server with instant compilation, hot reload, and automatic routing based on the file system. The App Router reads from app/ directory. Supports API routes, server components, and middleware.