How to install Laravel On Windows, macOS, and Linux (r) (r)

May 30, 2023
Learn how to install Laravel on all the major OSs

Share on

However, if you're brand new to the framework or aren't sure how to use it yet, don't worry! This article will guide you to learn how to use Laravel quickly.

This article will guide you through the process to install Laravel on Windows, macOS, and Linux operating systems.

First, let's look at what Laravel is, why it's beneficial, and the best way to benefit from it the best.

What is Laravel?

Laravel website.
Laravel site.

Laravel is a powerful and elegant PHP web application framework that streamlines web application development through an MVC (Model-View-Controller) architecture. The framework was created by Taylor Otwell, Laravel has gained immense recognition due to its ease of use and slickness of use and makes it the top selection for web designers around the globe.

The Key Features and Functions

The most important capabilities and functions that are offered by Laravel include:

Eloquent ORM to facilitate Database Interactions

Laravel's Object-Relational Mapping (ORM) allows for smooth and intuitive interactions with your database, making it easy to perform CRUD (Create the, Read, Update, delete) actions and control relationships across tables.

Blade Templating Engine

Artisan Command-Line Tool

The Laravel Artisan command-line tool provides an array of useful tools for everyday tasks for example, generating controllers migrations, and other things. This can speed development time and helps you keep a tidy, well-organized codebase.

Built-in Support For Tasks Scheduling and Authentication

This is all good to learn about, but who is the most effective utilization of Laravel? Let's look into that further.

Who Uses Laravel?

  • Startups Startups: For those who are just starting out, Laravel gives a quick development process, which helps develop their ideas quickly and efficiently. Laravel's tools built into the framework and libraries help save resources and time in the beginning phases of any project.
  • Established businesses Scalability and maintenance capabilities make it a desirable option for companies that are already established and seeking to develop or update the web-based applications they have. The framework's strong community backing means that firms can trust Laravel for long-term projects.

Below are some examples of companies using Laravel in their projects:

Bankrate

Bankrate is a renowned business in the field of financial services, which uses Laravel to develop and manage their online application. Laravel's framework assists Bankrate to manage complicated databases and accelerate developing cycles.

The New York Times

The New York Times uses Laravel for its internal web applications, helping the organization to develop and maintain complex web applications quickly and effectively.

St Jude Children's Research Hospital

St Jude Children's Research Hospital uses Laravel to power its online donation platform and various other applications on the web. Laravel helps the hospital efficiently manage large volumes of information and also provide secure authentication for users.

Geocodio

Geocodio is an online geocoding tool that can convert addresses into longitude and latitude coordinates, and reverse. Laravel is the platform that powers Geocodio's website application, which allows the company to offer its clients an accurate and reliable geocoding service.

October CMS

October CMS is a completely free open-source and free CMS for managing content (CMS) built upon Laravel. By leveraging the power and flexibility of the Laravel framework and the flexibility of Laravel, October CMS provides a user-friendly and flexible solution to manage the content on websites.

Advantages of Using Laravel

Laravel provides a range of benefits, making it a popular choice among web developers.

Rapid Development Process

Coding that is maintainable and readable

Solid Community and Strong Support

Laravel has an extensive and active developer community that contribute to the growth of the platform and provide support through forums, blogs, and social media. This makes it simple to get aid and assistance when required.

Built-in Tools and Libraries

Laravel comes with many built-in tools and libraries, such as Eloquent ORM, Blade templating engine as well as the Artisan command-line utility that can simplifies the development process and reduce the need for external dependencies.

You've decided to make use of Laravel But what are the things you know prior to starting? This is what we'll be discussing next.

Laravel Prerequisites

Before launching into Laravel There are some things that you need to be familiar with:

  • A basic understanding of PHP programming
  • Understanding of the MVC (Model-View-Controller) architectural pattern
  • Experience with Command Line/Terminal

System Requirements

Make sure your system is in compliance with the requirements listed below:

  • Compatible operating systems: Windows, macOS, Linux
  • Hardware requirements: Minimal (dependent upon PHP as well as Composer)
  • PHP installation: Required before installing Laravel
  • Composer installation Required to allow Laravel installation

Versions

When choosing a version of Laravel, consider these aspects:

  • Important to check compatibility ensure smooth integration with other libraries and PHP versions by verifying that your chosen version of Laravel works with your project's dependencies.

How Do I Install Laravel

After you've mastered Laravel and the system requirements it's time to begin installing it. Installation is simple and is comprised of easy procedures, but the steps differ from operating system to operating system.

Follow the steps that are specific to your operating system in the following section.

How Do I Setup Laravel on Windows

For installing Laravel to Windows Follow these step-by-step steps:

  1.    Install with XAMPP (to set up PHP and MySQL)
  2.    Install Composer
  3.    Verify Composer installation
  4.    Install Laravel using Composer
  5.    Verify Laravel Installation
  6.    Begin the Server
  7.    Run the project in your browser

1. Install XAMPP

The XAMPP download page for Windows.
The XAMPP Download page is for Windows.

Go to the Download page of XAMPP and download the proper installer to the version you have installed. Windows version.

Start the installer, and then follow the screen-based instructions. When installing you will be able to select which components you wish to install. You must select PHP as well as MySQL.

Once installed, launch the Control Panel for XAMPP and begin the Apache as well as MySQL services.

2. Install Composer

Composer is a dependency management software for PHP which is needed to install Laravel. In order to install Composer on Windows Follow these steps:

Go to the Composer download page to download the Composer-Setup.exe file.

Composer for Windows download page. 
Composer for Windows download page.

Run the Composer-Setup.exe file and follow the on-screen instructions.

Then, you'll be asked to select the install mode. Make sure you select the option to install for all users (recommended).

Make sure to select the correct PHP executable during the installation procedure (usually located within the XAMPP installation folder under xampp/php/php.exe).

Select Nextto move through the on-screen instructions then click to install.

After installation has been completed, click to close.

3. Verify Composer Installation

To confirm that Composer was installed correctly, open Composer's Command Prompt and run the below command:

composer --version

If the installation succeeded then you will see the Composer version on display.

4. Install Laravel by using Composer

It is possible to use Composer, which is now installed, to install Laravel worldwide on your computer. For this, you need to open the Command Prompt and run the following command:

composer create-project laravel/laravel app-name

It will download automatically all of the pertinent Laravel files needed to build an entirely new project.

5. Verify Laravel Installation

For a confirmation the installation of Laravel was properly installed To confirm that Laravel was installed correctly, start the Command Prompt and run the following command:

laravel --version

Following a successful installation you'll view your Laravel version.

6. Start The Server

Once you have your app's project created, you will have to then start the server. For this, type in the following information:

Cd app-name
php artisan serve

7. You can Run the Project In Your Browser

After the server has been started, it should be possible to access your app project through your browser. To do this, open your browser and go to the following: https://localhost:8000

With this, you can develop web-based apps using Laravel for your Windows machine.

How Do I install Laravel on macOS

For installing Laravel on macOS Follow these step-by-step instructions:

  1.    Installation Homebrew
  2.    Installation Node.js and NPM
  3.    Installation of PHP
  4.    Install Composer
  5.    Verify the PHP and Composer installations
  6.    Install Laravel with the help of Composer
  7.    Verify Laravel installation
  8.    Start a new project
  9.    Run through the Laravel server

1. Install Homebrew

Homebrew website.
Homebrew's Website.

Homebrew is a tool for managing packages that runs on macOS which makes it easier to install of software. To install Homebrew you need to open the Terminal and run the following command:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Follow the screen-based instructions to finish the installation.

2. Install Node.js and npm

Brew Install Node

This command installs both Node.js and npm on your computer.

3. Install PHP

Once you have Homebrew installed, you may then use it for installing PHP. The following command can be run from the terminal:

Brew install PHP

The installation will take a while to be completed.

4. Install Composer

Composer website.
Composer's site.

Composer is a dependency management program that is designed for PHP which is needed for installation of Laravel. For installation of Composer on macOS you must run these commands from the Terminal:

curl -sS https://getcomposer.org/installer | php sudo mv composer.phar /usr/local/bin/composer

5. Check the PHP and Composer installation

To confirm the installation of PHP and Composer have been installed properly, open the Terminal and run these commands:

PHP --version composer Version

If your installation was successful then you will see both PHP as well as Composer versions displayed.

6. Install Laravel Using Composer

If you've now got Composer installed, you can make use of Composer to set up Laravel. Start the terminal and execute the following procedure to install Laravel worldwide on your computer:

composer global require laravel/installer

Wait for the installation process to finish.

7. Verify Laravel Installation

To verify the installation of Laravel is installed properly, open the Terminal and execute the following command:

laravel --version

The installation is successful if you can see the latest version of Laravel that is displayed.

8. Make the New Project

For creating a brand-new Laravel project, use this command inside the terminal:

composer create-project --prefer-dist laravel/laravel app-name

Replace app-name with the preferred name you want for your project. This command will create an entirely new directory using the given name, and will add the Laravel framework within it.

Then, go to the brand new project directory:

Cd app-name

Remember to replace app-name with the exact name you chose in your project.

9. Use The Laravel Server

For the start of your local development server, run the following command in the directory of your project:

php artisan serve

This command starts a local development server on port 8000. You can access your Laravel application by opening your web browser and heading to:

http://127.0.0.1:8000

Now you should see an initial Laravel welcome page. It will indicate that your application is running successfully. Start building your Laravel application and view the changes live on the local development server.

How to Install Laravel on Linux

To install Laravel on Linux take these steps:

  1.    Setup Apache Web Server
  2.    Setup PHP
  3.    Installation of MariaDB
  4.    Install Composer
  5.    Verify PHP, MariaDB, and Composer Installations
  6.    Install Laravel with the help of Composer
  7.    Run the Laravel server

For installing Laravel on Linux Follow these step-by-step instructions:

1. Installation of Apache Web Server. Apache Web Server

Apache Web Server website. 
Apache Web Server website.
sudo apt update sudo apt install apache2

Once you have installed, turn on the Apache service, and then start it:

sudo systemctl enable apache2 sudo systemctl start apache2

2. Install PHP

To install PHP, use the following command from the Terminal:

sudo apt-install php the php mod libapache2-mod php: php Mbstring, PHP the php-xml format php-cli php php php-to the php-json format php-pear

3. Install MariaDB

MariaDB website.
MariaDB site.
sudo apt install mariadb-server

Once you have installed, make sure to secure Your MariaDB installation by running:

sudo mysql_secure_installation

Follow the screen instructions for setting up a root password and additional security setting.

4. Install Composer

Composer is a dependency management tool for PHP. Download and install Composer using these commands from the Terminal:

curl -sS https://getcomposer.org/installer | php
 sudo mv composer.phar
 sudo chmod +x /usr/local/bin/composer

5. Verify MariaDB, PHP, and Composer installations.

Ensure that PHP, MariaDB, and Composer are installed correctly through checking their version using the following commands:

PHP -v mysql -version composer --version composer

6. Install Laravel using Composer

Now, install Laravel through the following command from the terminal:

composer create-project --prefer-dist laravel/laravel app-name

Replace app-name above with whatever you like.

Then go to the newly made project directory:

CD app-name

7. You can run the Laravel Server

To start the development server of the project, visit the project directory and run the command you want to run.

php artisan serve

To open the Laravel application, run this command to launch the local development server at port 8000. Open your browser on the internet and go to:

http://127.0.0.1:8000

If everything has been properly configured it will allow you to access the default Laravel welcome page, which indicates that your application is up and running. Now Laravel is installed on the Linux system!

Summary

In this article we've discussed the procedure of setting up Laravel on Windows, macOS, and Linux. Once you've successfully installed Laravel on your chosen operating system, it's time to begin building robust and beautiful web applications with the renowned PHP framework.

If you're looking to learn more about Laravel make sure you explore the wealth of sources available to gain maximum benefit from this powerful tool. It is worth it. Laravel group is well-known for its steadfast support and complete documentation So don't hesitate to contact them if you require assistance.

Meanwhile, best of luck in your Laravel adventure!