Skip to main content
wpcrux.com

Back to all posts

How to Install Laravel?

Published on
4 min read
How to Install Laravel? image

Best Laravel Installation Guides to Buy in October 2025

1 CKE Upgraded Drill Guide 30 45 90 Degree Angle Drill Hole Guide Jig with 3 Drill Bits for Angled Straight Hole, Installation for Cable Railing Deck Stair Railing Lag Screw Kit Cable Wood Post DG02

CKE Upgraded Drill Guide 30 45 90 Degree Angle Drill Hole Guide Jig with 3 Drill Bits for Angled Straight Hole, Installation for Cable Railing Deck Stair Railing Lag Screw Kit Cable Wood Post DG02

  • ACHIEVE PRECISE ANGLES: 30°, 45°, AND 90° FOR DIVERSE PROJECTS.
  • DURABLE STEEL SLEEVES ENSURE ACCURACY, LASTING PERFORMANCE OVER TIME.
  • COMPATIBLE WITH MOST CABLE RAILING KITS FOR EFFORTLESS INSTALLATION.
BUY & SAVE
$21.24
CKE Upgraded Drill Guide 30 45 90 Degree Angle Drill Hole Guide Jig with 3 Drill Bits for Angled Straight Hole, Installation for Cable Railing Deck Stair Railing Lag Screw Kit Cable Wood Post DG02
2 Guide for Deacons

Guide for Deacons

BUY & SAVE
$7.95
Guide for Deacons
+
ONE MORE?

To install Laravel, you need to follow these steps:

  1. Install Composer: Laravel utilizes Composer, a dependency manager for PHP. Install Composer by downloading and running the Composer-Setup.exe/Composer-Setup.php file from the official website.
  2. Install Laravel Installer: Laravel provides a command-line tool called "Laravel Installer" to simplify the installation process. Open a command prompt and run the following command to install the Laravel Installer globally: composer global require laravel/installer
  3. Create a New Laravel Project: Navigate to the directory where you want to create your Laravel project using the command prompt. Run the command laravel new projectName to create a new Laravel project. Replace "projectName" with your desired project name.
  4. Serve the Laravel Application: Change to the project's directory using the command prompt. Run the command php artisan serve to start the Laravel development server at http://localhost:8000.
  5. Validate Installation: Open a web browser and visit http://localhost:8000 to ensure that Laravel is running properly. You will see the default Laravel welcome page if the installation was successful.

That's it! You have successfully installed Laravel and are ready to start developing your web applications using this powerful PHP framework.

How to install Laravel on Docker?

To install Laravel on Docker, follow these steps:

  1. Install Docker on your system and ensure it is running properly.
  2. Create a new directory for your Laravel project.
  3. Open a terminal window and navigate to the project directory.
  4. Run the following command to create a new Laravel project using the Laravel installer:

docker run --rm -v $(pwd):/app composer create-project --prefer-dist laravel/laravel .

This will create a new Laravel project inside your current directory.

  1. After the project is created, create a new Dockerfile in your project directory and add the following content:

FROM php:7.4-apache

Update package list and install required extensions

RUN apt-get update && apt-get install -y \ libpng-dev \ libonig-dev \ libxml2-dev \ libzip-dev \ zip \ unzip

Install PHP extensions

RUN docker-php-ext-install pdo_mysql mbstring exif pcntl bcmath gd zip

Enable Apache mod_rewrite

RUN a2enmod rewrite

Set working directory

WORKDIR /var/www/html

Copy composer files and install dependencies

COPY composer.lock composer.json ./ RUN composer install --no-autoloader --no-scripts

Copy Laravel project files

COPY . .

Generate the autoloader and update permissions

RUN composer dump-autoload RUN chown -R www-data:www-data /var/www/html/storage

Update Apache configuration

COPY docker/apache.conf /etc/apache2/sites-available/000-default.conf

Run the Apache server

CMD ["apache2-foreground"]

  1. Create a new directory named "docker" in your project directory, and create a new file named "apache.conf" inside the "docker" directory. Add the following content to the "apache.conf" file:

<VirtualHost *:80> DocumentRoot /var/www/html/public

<Directory /var/www/html>
    AllowOverride All
</Directory>
  1. In the terminal, navigate to your project directory and run the following command to build the Docker image:

docker build -t my-laravel-app .

  1. After the build process is complete, run the following command to start a new Docker container with the Laravel app:

docker run -p 8000:80 my-laravel-app

This will start the Docker container with your Laravel app running on port 8000.

You can now access your Laravel app by opening http://localhost:8000 in your browser.

Note: Make sure your Docker daemon is running before executing the Docker commands.

What is the command to install a specific version of Laravel via Composer?

To install a specific version of Laravel via Composer, you can use the following command:

composer create-project --prefer-dist laravel/laravel your-project-name "version"

Replace your-project-name with your desired project name and "version" with the specific Laravel version you want to install (e.g., "6.0.*" for Laravel 6.0.X).

The recommended PHP version for Laravel installation is PHP 7.3 or higher. It is always recommended to use the latest stable version of PHP for better performance and security.