Laravel has evolved over the years to provide developers with a smooth development experience. Within the Laravel framework, developers are equipped with a command that acts as a wrapper for the PHP built-in web server, enhancing the overall efficiency and convenience of the development process. This server allows developers to quickly spin up a development environment without the need for configuring complex web servers like Apache or Nginx. This tutorial shows how to use the built-in local development server in Laravel 10.
Note: The built-in web server is tailored for application development, useful for testing and showcasing. However, it's not meant to be a full web server and should not be used on a public network due to security concerns.
Go to the root directory of the Laravel project and run the local development server by using the serve
command:
php artisan serve
This command initiates the development server, and you should see output indicating the server is running. By default, Laravel uses port 8000, so you can access the application at http://localhost:8000
in the web browser.
The serve
command provides additional options, such as specifying a custom port or host. For instance, if you want to specify a custom host along with a port, you can use the following command:
php artisan serve --host laravel.local --port 8080
Leave a Comment
Cancel reply