I have an existing Laravel project, which I want to run in my browser, using VS Code. How do I do this?
1 Answer
There's a built-in terminal in vs code (on a different tab somewhere in the bottom), you can use it to serve your project by a local webserver, with the following command:
php artisan serve
After that you can see your project in your browser (localhost:8000 by default).
Please note this might not work out of the box on Windows.
11 Comments
Fred
Ok, I managed to get my Laravel project to show in my browser. I need to now proceed in debugging this project when it is running in the browser. How do I determine which file in the Laravel project must I place my first Breakpoint so that I can follow the flow of the project?
Bálint Budavölgyi
It depends on where it crashes, you can see it in the error message.
Fred
It isn't crashing. When I work in Visual Studio, I normally place a Breakpoint in one of the files which is an entry point to the project. This then allows me to follow the flow of the project from that point. I am trying to do the same in this Laravel project in VS Code, but I don't know which file is the entry point of the project. Placing a Breakpoint in the index.php file isn't doing anything?
Bálint Budavölgyi
The entry point of the application is
public/index.php, I recommend checking the documentation here: laravel.com/docs/5.6/lifecycleBálint Budavölgyi
You can stop execution with this function:
dd($foo). Check this question on breakpoints: stackoverflow.com/questions/28501077/… |
apache2, orphp artisan serve)