How to install Laravel and basic setup?

  • Post author:
  • Post category:Laravel
  • Post comments:0 Comments
  • Post last modified:October 5, 2020
  • Reading time:2 min(s) read

Laravel is that the Model-View-Controller(MVC) framework of PHP. it’s secure and relatively faster than other PHP frameworks. It comes with built-in Object Relation Mapping (ORM) which is named Eloquent ORM, it’s spoken because of the advanced implementation of PHP active record pattern.
In this blog, you may get to find out a way to install Laravel and its basic setup step by step. For video tutorials visit our youtube channel BeAppend.

To Install Laravel first you need to install the latest version of Xampp. If you already have installed the latest version of Xampp on your system then ignore it or to install Xampp click the following link: How to install Xampp in Windows PC.

Download the composer (PHP dependency manager) then install the composer-setup.exe file by clicking the following step as shown in the video[N.B: Please find the attached video for better understanding].

After that type composer global requires laravel/installer in the command prompt. It basically installs Laravel to your system.

Now go to the htdocs folder of your Xampp(C:\xampp\htdocs) then clear the path link and replace it with cmd and hit Enter from your keyboard. A command prompt will pop up then type laravel new “your project name(whatever you like)” then hit Enter from your keyboard then wait for the project to complete.

After creating the project start your Xampp then open your browser and type localhost/ followed by your respective project name. Then you will see something like the below picture. Then simply click on the public you will get to see the default UI of your project.

To remove the public from your URL just rename server.php in the root directory of your project folder as index.php then create a .htaccess file in the same directory and paste the code given below:

     Options -MultiViews -Indexes
    

    RewriteEngine On

    # Handle Authorization Header
    RewriteCond %{HTTP:Authorization} .
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

    # Redirect Trailing Slashes If Not A Folder...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} (.+)/$
    RewriteRule ^ %1 [L,R=301]

    # Send Requests To Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]

Leave a Reply