9 Simple Steps to Create Your 1st Laravel-8 Project and Run with Composer.

Praveena Thavarajah
4 min readMay 10, 2021

--

Laravel

I hope my previous post gave an introduction to Laravel framework. Now its time to create the 1st Laravel project.

A simple Laravel project on School Management System.

Prerequisites

1.Software to be downloaded

These are the software which I used to create the project. Links to download are mentioned, click on the name and navigate to relevant pages to download .

  1. VS Code (an IDE according to the preference)
  2. XAMPP
  3. Browser — Chrome (use any browser according to the preference)
  4. Composer

→ Initially go to xampp folder

→ Then go to htdocs folder

→ Create a folder inside the htdocs folder and name it according to your preference.

→ Double click on that folder and go into that folder

→ Add address bar type cmd and press enter

→ Then a command prompt opens.

Click on the link provided above to navigate to the download page of getcomposer.org. Under command line installation topic you can see some codes as mentioned below.

php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('sha384', 'composer-setup.php') === '756890a4488ce9024fc62c56153228907f1545c228516cbf63f885e036d37e9a59d27d63f46af1d4d07ee0f76181c7d3') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php
php -r "unlink('composer-setup.php');"

Copy the above codes and paste on the command prompt and press enter. Then the composer will be downloaded and finally shows a message in the command prompt as below.

php -r “unlink(‘composer-setup.php’);”

Note:- Suppose if you obtain an error as “not recolonize as an internal or external command”, when creating the project, refer the following link.

If the above solution did not work properly download the Composer-Setup.exe , install it in the folder which you have created already with the preferred name. Do not forget to set the paths as guided during the installation process and continue creating the project.

2. Basic knowledge on PHP is needed in-order to work with Laravel.

Create Project

  1. Open XAMPP
  2. Click start button(Actions) for Apache and MySQL
XAMPP
Apache and MySQL starts

3. Click Explorer button. Then xampp folder will appear.

xampp folder

4. Click on htdocs.

htdocs folder

5. Type cmd on the address bar. Then a command prompt will appear.

Type cmd on address bar

6. Then copy and paste the below code and press enter.

Here the project name is “school-management-app”.

composer create-project laravel/laravel school-management-app
Successfully created project

It will take some time to create the project. When the project is created successfully you will obtain a message as “Application key set successfully.” in the command line. Then a folder named school-management-app will be created inside the htdoc folder.

7. Then open vs code and open the project created.

Click on File → Open Folder → xampp → htdocs → school-management-app → Select Folder

Note : The below mentioned is the path(location) of the project folder which I have created through artisan. My project is in the C disk, inside the xampp folder, inside htdocs. C:\xampp\htdocs\school-management-app

Then you will visualize some folders and files as bellow.

vs code with created project

8. Now its the time to run the project created

There are two ways to run the project as mentioned below.

Method - 1

Go to command prompt and navigate to the relevant project folder (which has been created earlier), by typing the below command.

cd C:/xampp/htdocs/school-management-app

If you still have the command line which was opened in step 6 then run the following command.

cd school-management-app

Type the following command to run the project

php artisan serve
Running the project through the command prompt

Method -2

Go to VS Code, click on Terminal → New Terminal

Type the following command to run the project

php artisan serve
Running artisan command through vs code

9.Copy the Url generated after running the above command and paste it on the browser an press enter.

http://127.0.0.1:8000
Opened Laravel project

Conclusion

This is a simple Laravel project based on school management system was created using composer create-project.

--

--