Learn Android with Java and Kotlin

Install Laravel

Now as we have Composer installed, it’s finally time to install Laravel and create our first Laravel project. Now if you take a look at the documentation, you will find two approaches using composer.

  1. Go to https://laravel.com/ and click on Documentation.
  2. Click here on ‘Installation’ inside ‘Getting Started’ of the left menu, and then click on Installation via Composer.
    In the first approach, you have to run this command every time you want to create a new Laravel project.
    composer create-project laou ravel/laravel example-app
    Or, you can install Laravel globally with this command
    composer global require laravel/installer
    And then whenever you need to create a new project , you can simply run laravel new name_of_the_project
    laravel new example-app
  3. On the documentation, you will also notice this command…
    php artisan serve
    this loads the website using PHP’s in built webserver, but we have already set up our apache server, so we won’t use this command.
  4. On the XAMPP control panel, if we click on this ‘Explorer’ button, it will take us to the installation directory of XAMPP. Here you’ll find a folder named ‘htdocs’, and this is the place where we have to keep all our code.
  5. Now let’s create a folder here to keep our projects organized— let’s name it ‘Projects’ Now open the Command prompt and navigate to this folder. Or to directly open the Command prompt in this folder type ‘cmd’ on the address bar and hit Enter.
  6. Now lets install Laravel as global composer dependency by running this command..
    composer global require laravel/installer
  7. Once the Laravel installation is successful run the command laravel new BnS to create a new Laravel project for our ‘Buy and Sell’ website.
  8. After successful execution of this command, you’ll have a new folder inside the projects folder named ‘BnS’.
  9. On opening this folder you will see the structure of a Laravel project. We shall explore the directories of this structure as and when required during the course. Now let’s try to load the website on the browser.
  10. First verify that the apache server is running from the XAMPP control panel, and then on the address bar of the browser type http://localhost/projects/BnS , if you hit enter now, you will see the directory structure of the project. And a publicly viewable web page is there inside this public folder, so click on it or add /public to the url, it loads the default home page of our Laravel project.
  11. We shall remove this home page and add our own. But before that we shall add a virtual host for our convenience of accessing the website.

Leave a Reply

Your email address will not be published.