Skip to content

Vendor-neutral, engineer-written explanations. Clear definitions first, then practical steps with real examples — no fluff.

What is Composer and how do I use it to install Laravel?

SB
Written by StageBit Engineering Team
Updated January 2026 0 min readVerified by engineers

Composer is the standard dependency management tool for PHP, essential for installing Laravel and managing packages in any project. This guide explains what Composer is, how to install it, and how to use it to create and manage Laravel 12 projects.

What is Composer?

Composer helps PHP developers manage project dependencies efficiently. Key features include:

  • Automatically installs all required packages.
  • Handles version compatibility and updates.
  • Generates composer.json and composer.lock to track dependencies.
  • Ensures reproducible installations across different environments.

Installing Composer

Download Composer from getcomposer.org and install it globally so you can run it from any folder.

Verify the installation:

  • Run composer --version — you should see something like Composer version 2.6.5 2026-01-22

Installing Laravel Using Composer

There are two main ways to create a new Laravel project:

Option 1: Composer create-project

  • Command: composer create-project laravel/laravel my-project
  • Installs Laravel 12, sets up .env, vendor dependencies, and Artisan CLI.
  • Start development server: php artisan serve
  • Open http://127.0.0.1:8000 in your browser to see the Laravel welcome page.

Option 2: Global Laravel Installer (Recommended)

  • Install globally: composer global require laravel/installer
  • Create a project: laravel new my-project
  • Interactive setup options:
    • Choose a Starter Kit (Breeze, Jetstream, or none)
    • Select Database driver (SQLite, MySQL, PostgreSQL, SQL Server)
    • Choose a Testing framework (Pest or PHPUnit)
    • Automatically generates .env and APP_KEY
  • This is the preferred method for modern Laravel 12+ development and works perfectly on Windows.

Managing Laravel Dependencies

  • Update all dependencies: composer update
  • Install dependencies after cloning a repo: composer install
  • Add additional packages: composer require vendor/package

Was this answer helpful?

Your feedback helps us improve our answers.

Still need help?

Talk to our Laravel experts

We've handled GDPR/CCPA compliance for dozens of EU & US Laravel.

Talk to Laravel Experts

Tell us more about your brand!

Rohit Kundale, Our VP of Sales and Marketing is ready to meet with your team.