Laravel Installation and setting up first project

Last updated : Jul 04, 2021

In this article you will know how to install Laravel and setup first app in Laravel. Those who want to get started with Laravel programming this article for you.

Okay, lets get started

To work in Laravel, you need to have PHP installed and added to environment variables. So in that case the simplest way to install PHP is from Xampp official downloads page.

XAMPP is great package which contains PHP, MYSQL, PERL and FTP and many other services which are really helpful in developing PHP related web applications. It is also available for all systems such as LAMPP for Linux based systems, WAMPP for windows for Windows and MAMPP for MAC.

 

After installing PHP in your system, its time to add your PHP runtime in environment variable.

 

For Windows users: XAMPP configures PHP path automatically but if its not the case,

1. then click start and type environment and select first option which says edit the system environment variables

2. then a dialog box will appear click environment variables button on bottom of the dialog box,

3. after this another dialog box will appear, in that box double click Path in system variales and the complete path of disk where your php is installed. That's it.

 

For Ubuntu users:

1. LAMPP is usually stored in /opt/lampp directory

2. so open up your terminal and type sudo ~/.bashrc and file will open

3. at the end of the file, type export PATH=$PATH:/opt/lampp/bin. That's it.

 

So after successfully installing PHP and adding to PATH variable, it's time to install another important tool called 'Composer'

 

For Windows users:

Go to https://getcomposer.org/download/ and download .exe file and install and it will automatically add composer path to environment variables and if it is not added, you can add them by repeating the above steps.

 

For Ubuntu user:

1. Open terminal and type sudo-apt update

2. then type sudo apt install curl

3. type sudo curl -sS https://getcomposer.org/installer | php

4. type sudo mv composer.phar /usr/local/bin/composer

5. it's done. To check if it is installed type composer

6. and lastly don't forget to add composer in the PATH variable by repeating above steps.

 

Now it's time to install Laravel

It's same for all the systems

1. Open terminal/command prompt and type composer global require laravel/installer

2. Add AppData\Roaming\Composer\
vendor\bin to environment variables in Windows

3. Add $HOME/.config/composer/vendor/bin to PATH variable in Ubuntu

 

Alright now it's time create a Laravel project

1. Open terminal/command prompt

2. Type laravel new projectname

 

Done.



Sign in for comment. Sign in