Prerequisite to install Laravel on Windows 10
- XAMPP: It is a web server that bundles all necessary software like Apache HTTP Server, MariaDB database, and interpreter to run PHP and Perl Scripts. You can install Xampp free from Download XAMPP For Windows 10
- Composer: Composer is a package manager for PHP programming language. In Laravel, it is required to install packages and Laravel itself. You can download and install Composer free from Download composer for Windows 10
System requirements to Install Laravel
- PHP >= 5.4, PHP < 7
- Mcrypt PHP Extension
- OpenSSL PHP Extension
- Mbstring PHP Extension
- Tokenizer PHP Extension
Once the above requirements are completed then you can install Laravel by running below command on your cmd.
composer create-project --prefer-dist laravel/laravel YourProjectName
Running above command will install the latest version of the Laravel framework on your computer.
Creating Database for Project
Follow the below steps to create a Mysql database.
- Go to on browser and open PHPMyAdmin by typing http://localhost/phpmyadmin
- Enter your PHPMyAdmin username and password. By default username of PHPMyAdmin is root and the password is empty.
- Click the new link from the sidebar to create a new database.
- Type the database name you want to create and click on the create button.
Configuring Database Connection in Laravel.
Laravel has made Database Configuration very easy. To configure your database simply open .env file and update the following information. Note: .env file is found in the root directory of your project.
DB_DATABASE= // name of database that you have created
DB_USERNAME= // username of mysql
DB_PASSWORD= // password of mysql
Running your Laravel project
To run our Laravel application, cd to your project directory and run below command
php artisan serve
Output: Laravel development server started: <http://127.0.0.1:8000>
Open http://127.0.0.1:8000 URL on the browser to see the app.
Voila!! You have successfully installed and created your first Laravel Project on windows.