Laravel To change default host and/or port for the artisan serve command

In this tutorial learn how to change default host or port in laravel with run php artisan serve command.

To change default host and/or port for the artisan serve command, you need to edit the ServeCommand.php file:

$ sudo nano vendor/laravel/framework/src/Illuminate/Foundation/Console/ServeCommand.php


At the end of it you will find were they are configured:

protected function getOptions()
    {
        return [
            ['host', null, InputOption::VALUE_OPTIONAL, 'The host address to serve the application on', '127.0.0.1'],
            ['port', null, InputOption::VALUE_OPTIONAL, 'The port to serve the application on', '8000'],
        ];
    }

Replace with your host with 127.0.0.1 and port with your required port with 8000




No comments:

Post a Comment

how to call ssh from vs code

 To call SSH from VS Code, you can use the built-in Remote Development extension. This extension allows you to open a remote folder or works...