As we have discussed in our previous blog about what laravel is and why laravel is so popular among list of other php framework’s. Now lets get started with how to install laravel and Set up the environment to code your first project on laravel.
STEP -1 : Setting up a local Development Server For Laravel
You’ll need to download a local web server software stack like WAMP, XAMPP, AMPP which basically is a collective of Apache web server, open SSL fir SSL , PHP and mysql database.
Laravel also provides its own prepackaged Vagrant box that provides you a best development environment without requiring you to install PHP, a web server, and any other server software on your local machine. But you need to install virtual box ,parallels or hyper -V and vagrant according to the OS you use to run the laravel’s homestead environment.
There are some pre – requisites for the server which you need to know if you installed the server manually as laravel’s homestead meets all the necessary server requirements.The following are the pre requisites needed for laravel php development environment :
- PHP version should be greater than or eqal to >= 7.1.3
- Server should include OpenSSL PHP Extension
- Server should include PDO PHP Extension
- Server should include Mbstring PHP Extension
- Server should include Tokenizer PHP Extension
- Server should include XML PHP Extension
- Server should include Ctype PHP Extension
- Server should include JSON PHP Extension
- Server should include MCrypt PHP Extension
STEP -2 : Downloading and Installing Composer
Laravel uses Composer which is an application-level package manager for the PHP programming language. Composer provides a standard format for managing dependencies of PHP software and required libraries. So, its necessary to install composer in the server that will host the web application.
You can download composer from the following link https://composer.org/download/
For windows :
You can directly install the Composer-Setup.exe. file to any location you prefer then the composer will prompt you to locate the php.exe file.
1- Double click Composer-Setup.exe.
2- In Installation Option screen, select the Developer mode and then Click Next.
3- Give an appropriate path to your Composer example C:\composer\
4- Choose command line php you want to use for example : I use ampps and my php executable file resides
in the following path C:\Program Files (x86)\Ampps\php-7.1\php.exe . The path for php executable file can be different according to the local server app we use. And click Next to Finish the installation.
STEP -3 : Setting up PATH
After the installation of Dependency manager for php i.e. ‘Composer’. We now configure environment PATH variable for composer to access it from any directory.
- RIght Click My PC in your Desktop and click on Properties.
- Go to Center Right Corner of the popup window and click on Change Settings.
- Go to Advanced Tab From the popup windows and click on Environment Variables.
- Go to System Variables Select Path Row from the Variable Column and Click on Edit .
- Add the path where you have installed Composer, for example: ‘C:\composer’ .
- Click on Ok.
STEP -3 : Installing Git
- Click here to Download Git For flavors of OS.
- Accept the policy and Click Next.
- Choose the default option and select next
- The default path of GIT will be C:\Program Files\Git
STEP-4: Becoming a PHP Artisan
- Go to the Directory where yopur local server serves the file. Example Ammps Serves the files from directory C:\Program Files (x86)\Ampps\www and xampp serves from the directory ‘htdocs’.
- Right Click and Click on GIT Bash .
- Type the following code to create a blog using laravel
composer create-project laravel/laravel laravelsite
- Go to your Browser and insert the url http://localhost/laravelblog/public