In this chapter, we will learn how to install laravel framework. I am using windows OS & latest version of laravel framework which is 5.8 now. It needs PHP version 7.1.3 or higher. Make sure you have this PHP version installed in your system.
You can install it using two different methods
Open command prompt and use following command. Make sure you installed composer before using this command. A composer is a great tool for dependency management. You can install and update PHP libraries with this tool. After that, use the following command to install laravel globally.
composer global require laravel/installer
Open PHP project directory (htdocs, if you are using XAMPP or www, if you are using Wamp). Use the following command to install fresh new Laravel latest version. Now anytime if you want new Laravel installation only use the following command.
laravel new folder-name
With this in mind, go to the PHP project directory and use the following command. It allows you to install the latest version of Laravel.
composer create-project --prefer-dist laravel/laravel folder-name
Furthermore, you can install a specific version of Laravel. To do that, you can use a specific version along with the above command.
composer create-project --prefer-dist laravel/laravel folder-name "5.8"
Finally, Open command prompt inside the project directory and type:
php artisan serve
As a result, it will start a development server on http://localhost:8000. In that case, keep running your command prompt. After that, you can visit http://localhost:8000 in a browser.
Besides, you can start a server in your own port too. To do that, amend the above code as follows. It will start a development server on a defined port.
php atisan serve --port=8001
Please keep support with comments and sharing. Thank you for reading this tutorial. Have a great day 🙂
This is very helpful tutorial for beginners to understand and learn easily by following steps as provided in tutorial.