How to use composer to install Laravel without errors

What is Laravel?

Laravel is a PHP MVC framework that makes coding in PHP very simple and provides enhanced security to an application by default. Laravel also accepts the installation of third-party packages via composer to add more functionality to your application. One advantage of Laravel is that its syntax that’s easy to read. Laravel currently supports the following databases: Sqlite, Mysql, Postgres, and SQL.

How to install Laravel

The installation of Laravel is very simple.

Download and install Composer if you don’t have it already.

You will need a strong and reliable network because any interruption in your network can cause a break in the file being pulled into your application from the repository, therefore throwing several errors at the end of the day.

Step 1

Install the Wamp Server on your computer. The Wamp server provides you with more than one PHP version, which will help when you want to test run existing applications running on lower or higher versions of PHP. Download Wamp here.

Step 2

Go to C:\wamp64\www in Windows.

Step 3

If you have VSCode installed on your system, right-click and select open with VSCode. Otherwise, clear the address bar in the C:\wamp64\www directory, type cmd, and press enter.

Benefits of putting our application in the www wamp directory

  1. Makes it easy to deploy from our localhost server to shared hosting.
  2. You won’t need to run the php artisan serve command to start your application.
  3. You will code like you are on a live server, aside from the fact that your application may not have ssl.
  4. The application will have the same file structure on both the Cpanel and the local server.

Step 4

At this stage, you are either in your VSCode editor or your CMD. For VSCode, select the Terminal in the menu bar.

The first command we run is as follows:

composer create-project laravel/laravel app_name

This command fetches and creates a fresh Laravel application for you inside the app_name directory.

You can cd into the directory like so:

cd app_name

You can serve your application by running php artisan serve or you can visit localhost/app_name/public.

Ensure your Wamp server is running.

You can also check out this answer on Breeze installation for your authentication system.

Free Resources