Simple step-by-step instructions for installing Laravel on your system via the command line (CLI).
Let's go through all the steps together:
Step 1: Make sure you have PHP and Composer installed
- Check PHP: Open a command prompt and type:
php -v
If PHP is installed, you will see the version. If not, you will need to install it.
- Install Composer: If you don't have Composer yet, you can install it by following the instructions on Composer's official website.
Step 2: Install Laravel
- Create a Laravel project: After installing Composer, you can use the following command to install a new Laravel project. Replace `my-project` with the name of your project:
composer create-project --prefer-dist laravel/laravel my-project
This command will create a new folder named `my-project` and install a fresh copy of Laravel into it.
- Go to the project folder:
cd my-project
Step 3: Setting up the environment
- Copy the environment file: Laravel uses the `.env` file to store configuration parameters. Create a copy of the `.env.example` file and rename it to `.env`:
cp .env.example .env
- Generate the application key:
php artisan key:generate
Step 4: Start the server
Now you can run the built-in Laravel server. Do the following:
php artisan serve
After executing this command, you will see a message that the server is running, usually at `http://localhost:8000 `.
Step 5: Open in the browser
Open your browser and go to `http://localhost:8000 `. You should see the Laravel start page.
Congratulations!
Now you have Laravel installed on your system and you can start developing your applications!