How to install a laravel 10 project
- User
How to install a laravel 10 project
- Assistant
To install a Laravel 10 project, you need to follow several steps to ensure everything is set up correctly. Laravel is a PHP framework, and you'll need to have certain tools and software installed on your system before starting. Below are the steps to install a new Laravel 10 project:
Prerequisites
-
PHP: Ensure you have PHP 8.1 or newer installed. You can check your PHP version by running
php -vin your terminal. -
Composer: This is a dependency manager for PHP. You can download and install Composer from getcomposer.org.
-
Development Environment:
- Local server environments like XAMPP, WAMP, MAMP, or Laravel Homestead.
- Alternatively, use Laravel Valet if you are on macOS.
-
Node.js and NPM: Required if you plan to use Laravel Mix for asset compilation.
Installation Steps
-
Open your terminal and navigate to the directory where you want to install your Laravel project.
-
Use Composer to create a new Laravel project:
bashcomposer create-project laravel/laravel example-appReplace
example-appwith your desired project name. -
Navigate into your project directory:
bashcd example-app -
Set up your
.envfile:- Duplicate the
.env.examplefile and rename it to.env. - Configure your environment settings like database connection, mail server, etc.
- Duplicate the
-
Generate an application key:
bashphp artisan key:generateThis command sets the
APP_KEYin your.envfile. It is used for encryption and session handling. -
Set up the database:
- Ensure that a database is created for your application.
- Update your
.envfile with the correct database connection details:
-