简体   繁体   中英

Laravel PHP run php artisan serve automatically if something changes

I am using laravel for a php webproject.

Yesterday I noticed an issue:

Everytime I make changes fe in the controller files I need to rerun php artisan serve , which consumes a lot of time (close CMD, open it again and type php artisan serve )

I am trying to find a way, so this command will automatically rerun when I test my application on localhost.

I could probably write a script or something with Python, which will automatically open CMD and execute php artisan serve whenever I click fe CTRL + F5 , but that feels very hacky, is there a cleaner solution?

I also found a guide on how to edit the hosts file in system32 folder and the httpd-vhosts.conf in the apache folder, but after doing all steps, if I try to reach my application I get "It works" instead, which is simply an indicator for a successfull apache installation.

You should avoid php artisan serve cause it's just a shortcut to run your Laravel project. For a better development environment, you should use Laravel Homestead which offers a complete solution.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM