Laravel Installation and changing the welcome page

Laravel is a PHP web application open-source framework created by Taylor Otwell in 2011 and it follows the Model-View-Controller (MVC) architecture like all other modern frameworks, If you are thinking of building a PHP-based web application then laravel is the best option nowadays.

In this article, we are going to install laravel via composer and we will write our first view and we will test it in the browser.


What you should know before starting laravel:

  • Basic knowledge of PHP
  • Basic knowledge of Terminal or Command Prompt
  • Basic knowledge of HTML

System requirements:

  • You should have xamp or wamp installed in your system
  • You should have composer installed in your system because for managing dependencies laravel uses composer you can install composer by clicking here.
  • a code editor installed in your system I prefer a visual code editor


Now you are ready to install laravel in your system.

Open Command Prompt or Terminal: Open Command Prompt or Terminal and navigate to the directory where you want to install Laravel.

Install Laravel: Run the following command to install Laravel 9:

        
        composer create-project laravel/laravel my-project-name "9.*"
        
    

This command will create a new Laravel project in a directory named "my-project-name" in the current working directory.

Start XAMPP: Start XAMPP and make sure that Apache and MySQL services are running.

Create a database: Open phpMyAdmin in your web browser and create a new database for your Laravel project.

Configure the database: Open the ".env" file in your Laravel project directory and set the database name, username, and password.

Run migrations: Run the following command to create the necessary tables in your database:

        
        php artisan migrate
        
    

Related Post

Start the server: Run the following command to start the Laravel development server:

        
        php artisan serve
        
    

Access the project: Open your web browser and navigate to http://localhost:8000 or http://127.0.0.1:8000 to access your Laravel 9 project.  If everything will ok then you will see the bellow screen.



That's it! You have successfully installed Laravel 9 in your system.

Change the welcome page:

Now, if you want to change the welcome page content just open your laravel directory in the code editor and go to your-laravel-folder>resources>views>welcome.blade.php  and remove all code and past the below code and go to your browser and refresh the page you will see the changes.

        
        <!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title></title>
</head>
<body>

<h1> My first laravel project</h1>

</body>
</html>
        
    

Leave a comment