DEV Community

larawell-done
larawell-done

Posted on

Getting started with Laravel 10 - Installation

Laravel is a popular open-source PHP framework that is widely used for web development. It's known for its simplicity, flexibility, and powerful features that make it easier for developers to build robust and scalable applications. In this blog, we'll guide you through the process of installing Laravel 10 on any type of system, whether you're running Windows, macOS, or Linux.

Before installing Laravel 10, you need to ensure that your system meets the following requirements:

  • PHP 8.1
  • Composer
  • MySQL or any other database

Step 1: Install Composer

Composer is a dependency manager for PHP that helps you manage packages and libraries. Laravel uses Composer, so you'll need to install it on your system before you can proceed with the Laravel installation.

To install Composer, you can follow the steps below:

  1. Go to the official Composer website and download the installation package for your system.

  2. Run the installation package and follow the instructions to complete the installation.

  3. To verify that Composer is installed, open your terminal or command prompt and run the following command:

composer --version
Enter fullscreen mode Exit fullscreen mode

This should display the Composer version installed on your system.

Step 2: Install Laravel

With Composer installed, you can now proceed with installing Laravel by following these steps:

  1. Open your terminal or command prompt and navigate to the directory where you want to install Laravel.
  2. Run the following command to install Laravel:
composer create-project --prefer-dist laravel/laravel <project-name>
Enter fullscreen mode Exit fullscreen mode

Replace <project-name> with the name of your project.

  1. Composer will now download and install Laravel and its dependencies. This process may take some time depending on your internet speed and the complexity of your project.

  2. Once the installation is complete, you can verify that Laravel is installed by navigating to the project directory and running the following command:

php artisan --version
Enter fullscreen mode Exit fullscreen mode

This should display the version of Laravel installed on your system.

Congratulations, you've successfully installed Laravel 10 on your system.

Step 3: Configure the Database

Laravel uses a configuration file called .env to manage your application's environment variables. Open the .env file in your project directory and configure your database settings. You'll need to set the following variables:

DB_DATABASE=your_database_name
DB_USERNAME=your_database_username
DB_PASSWORD=your_database_password
Enter fullscreen mode Exit fullscreen mode

Replace your_database_name, your_database_username, and your_database_password with your own database credentials.

Step 4: Serve the Application

Finally, you can serve your application by running the following command in your terminal:

php artisan serve
Enter fullscreen mode Exit fullscreen mode

This will start a local development server that you can access by visiting http://localhost:8000 in your web browser.

http://localhost:8000

Conclusion

In this blog post, we've gone through the steps for installing Laravel 10 on your system. Now that you have Laravel installed, you can start building your web application with this powerful framework. Happy coding!

Top comments (0)