How to Install Laravel 11 PHP Framework Example

Sovary November 30, 2024 203
1 minute read

Hi Artisan, today I am going to explain you how to install Laravel 11 with composer. I will explain and show step by step to install composer and Laravel project. To install the Laravel 11 PHP framework from scratch, follow these detailed steps. Before starting, ensure your system meets Laravel 11's technical requirements, which include a compatible PHP version, web server, and database support:

Prerequisites

  • Install PHP (8.2 or later): Laravel 11 requires PHP 8.2 or newer (my case PHP version 8.4.1)
  • Install Composer: Ensure Composer is installed for managing dependencies. You can download it from getcomposer.org. (my case composer version 2.8.3)

Install Composer

Before we can download laravel we have to download composer and install it. If you already installed composer, you can check composer version run command below:

composer --version

Install Laravel

Launch command prompt (cmd), and run command as below

composer create-project laravel/laravel:^11.0 Laravel11

This will generate a project named Laravel11 in your current directory, along with all necessary dependencies. Now navigate to project directory

cd Laravel11

 To check your Laravel version with command below:

php artisan --version

Output:

Laravel Framework 11.34.2

Database Configuration

In Laravel root directory you will see a file named .env. There is a few configuration related to your credential information. Set database credentials (DB_DATABASE, DB_USERNAME, and DB_PASSWORD) for your environment.

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=your_database_name
DB_USERNAME=your_database_username
DB_PASSWORD=your_database_password

Run Database Migrations

To create necessary tables, use:

php artisan migrate

Start the Development Server

Now we can run launch the local server with command

php artisan serve

Then we can go to browser and see first home page laravel project via http://localhost:8000

install laravel 11 home page demostration

Hope you can install successfully and run Laravel project. Thanks

Laravel  Laravel 11 
Author

As the founder and passionate educator behind this platform, I’m dedicated to sharing practical knowledge in programming to help you grow. Whether you’re a beginner exploring Machine Learning, PHP, Laravel, Python, Java, or Android Development, you’ll find tutorials here that are simple, accessible, and easy to understand. My mission is to make learning enjoyable and effective for everyone. Dive in, start learning, and don’t forget to follow along for more tips and insights!. Follow him