Hello Artisan, In this article I will let you know how to install latest version of laravel 10 in Windows, Linux, macOS. Laravel is a popular open-source PHP web framework that is widely used for building web applications. It offers many features such as a robust routing system, ORM, MVC architecture, and more. So let's get dive into it!
Prerequisites:
Before starting the installation process, you need to make sure that your system meets the following requirements:
- PHP >= 8.1
- Composer installed ( Version >= 2.2)
- Web Server (Apache or Nginx)
- MySQL or any other database supported by Laravel
Step 1 : Installation
There are several ways to install Laravel, depending on your operating system and preferences.
1. Using Composer:
Laravel is built on top of Composer, a dependency manager for PHP. To install Laravel using Composer, you need to have Composer installed on your system. Once you have Composer, open a terminal or command prompt and run the following command:
composer create-project laravel/laravel firstapp
This command will create a new Laravel project in a directory named firstapp in your current working directory.
2. Using Laravel Installer:
If you prefer not to use Composer, you can install Laravel using the Laravel Installer. First, install the installer globally using Composer:
composer global require laravel/installer
Once the installer is installed, you can create a new Laravel project by running:
laravel new firstapp
3. Using Docker:
If you prefer to use Docker, you can use a pre-built Laravel Docker image to create a new Laravel project. First, create a new directory for your project:
mkdir firstapp
cd firstapp
Then, create a docker-compose.yml file with the following content:
version: '3'
services:
app:
image: laravel/laravel:latest
volumes:
- ./:/var/www/html
Finally, run the following command to start the Laravel Docker container:
docker-compose up -d
Step 2: Serve the project
To serve and start your Laravel 10 project, navigate to the project directory and run the following command:
php artisan serve
This command will start the development server, and you can access your Laravel 10 project by visiting http://localhost:8000 in your web browser.
Step 3: Setup configs and db details in .env
If you want to use a database for your Laravel 10 project, you need to configure the database connection. Open the .env file in your project directory and update the following lines with your database credentials:
DB_DATABASE=your_database_name
DB_USERNAME=your_database_username
DB_PASSWORD=your_database_password
Save the changes and run the following command to migrate the database tables:
php artisan migrate
Conclusion
In this article, we discussed the steps involved in installing the latest version of Laravel, Laravel 10, on your system. We also discussed the prerequisites required to install Laravel 10. Once you have Laravel 10 installed, you can start building your web applications using the new features and improvements provided by the framework.