You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Laravel新手:如何在VS Code中启动项目并进行调试?

How to Start a Laravel Project in VS Code (For Beginners)

Hey there! Since you're new to Laravel and looking to launch your project in VS Code, let me walk you through the simple, straightforward steps to get up and running:

1. Open Your Laravel Project in VS Code

  • Launch VS Code on your machine.
  • Click File > Open Folder (or use the shortcut Ctrl+K Ctrl+O for Windows/Linux, Cmd+K Cmd+O for Mac).
  • Navigate to the root folder of your existing Laravel project and select it. If you haven’t created a project yet, run composer create-project laravel/laravel your-project-name in your terminal first to generate one.

2. Launch the Built-in Terminal

VS Code’s integrated terminal saves you from switching between apps:

  • Open the terminal by clicking Terminal > New Terminal (or use the shortcut Ctrl+` for Windows/Linux, Cmd+` for Mac).
  • The terminal will automatically load at the root directory of your Laravel project—perfect for running commands.

3. Start the Laravel Development Server

This is the core step to run your project locally:

  • In the VS Code terminal, run this command:
    php artisan serve
    
  • Once it’s up and running, you’ll see output like this:

    Laravel development server started: http://127.0.0.1:8000

  • Copy that URL, paste it into your browser, and you’ll see Laravel’s default welcome page!

4. Optional: Boost Your Workflow with Extensions

To make your Laravel journey smoother, install these handy VS Code extensions:

  • Laravel Blade Snippets: Adds time-saving snippets for Blade templates.
  • PHP Intelephense: Provides robust auto-completion and syntax checking for PHP code.
  • Laravel Extra Intellisense: Enhances code suggestions for Laravel-specific elements like routes, views, and models.

Quick Troubleshooting Tips

  • If you get a "command not found" error for php artisan, double-check that your terminal is pointed to the root directory of your Laravel project.
  • If port 8000 is already in use, run php artisan serve --port=8080 to use a different port instead.

内容的提问来源于stack exchange,提问作者Fred

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.26 10:16:23