Manamil Dev Logo

Muhammad Manamil on November 04, 2025

How to Install Composer for Ubuntu and Windows Step-by-Step Guide

How to Install Composer for Ubuntu and Windows Step-by-Step Guide
Share on X Share on Facebook Share on LinkedIn

When it comes to building powerful and scalable web applications using Laravel, the first step is setting up Composer — a PHP dependency manager that installs and manages all the libraries Laravel needs.

Without Composer, you cannot install Laravel or manage its ecosystem efficiently. That’s why understanding how to install and configure Composer properly is essential for every PHP developer.

In this complete guide, you will learn how to install Composer on both Windows and Ubuntu, step by step, so you can start your Laravel projects smoothly.

Why Composer is Important

Composer is a dependency management tool for PHP. It allows you to declare the libraries your project requires and then manages (installs and updates) them automatically.

For Laravel, Composer handles:

Think of Composer as the “npm for PHP” — it makes managing PHP projects simple and efficient.

Composer Use in Popular PHP Frameworks

Composer is used in almost every modern PHP framework, including:

  • Symfony

  • Laravel

  • CodeIgniter 4

  • CakePHP

  • Yii2

  • Slim Framework

  • FuelPHP

  • OctoberCMS, Drupal, Magento, WordPress

System Requirements

To install Composer, make sure your system meets these requirements:

  • PHP version: 8.3 or above (older versions may also work)

  • Local server: Latest version of XAMPP or WAMP (for Windows users)

Installing Composer on Windows

Follow these steps to install Composer on Windows for Laravel development.

Step 1: Check PHP Installation

Composer requires PHP to run. Open your Command Prompt and type:

php -v

If PHP is installed, you will see a version number similar to this:

Step 2: Download Composer Installer

Go to the official Composer website:
https://getcomposer.org/download/

Click on “Composer-Setup.exe” (Windows Installer) to download.

Step 3: Run the Composer Installer

  • Run the downloaded .exe file

  • The installer will automatically detect your PHP installation and configure everything

  • Proceed with the default installation settings

  • Once installation is complete, click Finish

Step 4: Verify Installation

Open Command Prompt again and type:

composer

If you see the Composer version and usage details, installation was successful.

Step 5: Check Composer Version

Test your installation by typing:

composer -v

You should see output like:

picture

Installing Composer on Ubuntu (Linux) 

Follow these steps to install Composer on Ubuntu.

(If you want to install laravel on ubuntu.)

Step 1: Update Your System

First, update your system packages:

sudo apt update
sudo apt upgrade -y

Step 2: Install PHP and Required Extensions

Composer requires PHP and some extensions. Install them using:

sudo apt install php php-cli unzip curl -y

Verify PHP installation:

php -v

If you see the php version and usage details, installation was successful.

Step 3: Download Composer Installer

Run the following commands:

cd ~
curl -sS https://getcomposer.org/installer -o composer-setup.php

Verify Installer Signature (Recommended)

HASH_EXPECTED="$(curl -sS https://composer.github.io/installer.sig)"
php -r "if (hash_file('sha384', 'composer-setup.php') === trim('$HASH_EXPECTED')) { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"

If you see Installer verified, you can continue.
If you see Installer corrupt, delete the file and re-download.

Step 4: Install Composer Globally

sudo php composer-setup.php --install-dir=/usr/local/bin --filename=composer

Remove the installer (temporary file):

rm composer-setup.php

Why remove it?
The composer-setup.php file is only a temporary installer script. Once Composer is installed, it is no longer needed.

Step 5: Verify Installation

Check Composer version to confirm installation:

composer -V

You should see something like:

   ______
  / ____/___  ____ ___  ____  ____  ________  _____
 / /   / __ \/ __ `__ \/ __ \/ __ \/ ___/ _ \/ ___/
/ /___/ /_/ / / / / / / /_/ / /_/ (__  )  __/ /
\____/\____/_/ /_/ /_/ .___/\____/____/\___/_/
                     /_/

Composer version 2.8.11 2025-08-21 11:29:39

Featured Posts

Read Next

January 19 2026

Unmasking the N+1 Query Problem in Laravel: Your Guide to Faster Apps

Stop the N+1 query problem from killing your Laravel app's performance! 🚀 Learn exactly what causes this common database bottleneck and how to fix it in seconds using Eloquent Eager Loading (with()). Perfect for beginners looking to write professional, lightning-fast code.

November 10 2025

Laravel 12 Routing – Defining Routes in bootstrap/app.php

Laravel 12 introduces a new, cleaner way to define routes directly in bootstrap/app.php. This guide explains how the new routing system works, with step-by-step examples, migration tips, and best practices for integrating inline and traditional route definitions seamlessly.

November 10 2025

Laravel 12 Social & Passkey Authentication (AuthKit) – Complete Guide

Authentication is one of the most important parts of any modern web app — and Laravel 12 makes it easier than ever with AuthKit, which supports social logins (like Google, GitHub, Facebook) and passkey authentication (passwordless login using Face ID, Touch ID, or security keys). In this guide, you’ll learn step-by-step how to set up Social Login + Passkey Authentication in Laravel 12 using AuthKit — from scratch.

Design Circle Design Circle
Manamil Dev Logo

Built by a developer, for developers — free tools and real-world guides to help you code smarter, faster, and without the guesswork.

© 2026 — manamil.dev. All Rights Reserved.