What PHP version is required for Laravel 12

laravel
tutorial
installation
Nabil Hassen
Nabil Hassen
Oct 22, 2025
What PHP version does Laravel 12 require?
Last updated on Oct 22, 2025
Table of contents:

Required PHP Version for Laravel 12

Laravel 12 requires PHP 8.2 or higher to run. This version requirement aligns with Laravel's commitment to supporting modern PHP features, improved performance, and better type safety.

How to Check the Required PHP Version for Any Laravel Version

To check which PHP version is required for a specific Laravel release, follow these steps:

  1. Go to the laravel/laravel GitHub repository.
  2. Switch to the branch corresponding to the version you want to check (for example, 12.x, 11.x, etc.).
  3. Open the composer.json file.
  4. Find the require section and you’ll see the PHP version requirement listed like this:
"require": {
"php": "^8.2",
...
}

This ensures you always verify against the official and most accurate source.

How to Check Your PHP Version

You can quickly verify your PHP version using the following command:

php -v

Example output:

PHP 8.2.12 (cli) (built: Sep 27 2024 15:00:00) (NTS)

If the version displayed is 8.2.0 or higher, you’re ready to install Laravel 12.

How to Upgrade PHP

If your PHP version is lower than 8.2, upgrade it before creating or running a Laravel 12 project.

On Ubuntu / Debian

sudo add-apt-repository ppa:ondrej/php -y
sudo apt update
sudo apt install php8.2 php8.2-cli php8.2-common php8.2-mbstring php8.2-xml php8.2-bcmath php8.2-curl php8.2-zip -y

On macOS (Homebrew)

brew update
brew install [email protected]
brew link [email protected] --force

On Windows

  1. Download PHP 8.2 from windows.php.net/download.
  2. Extract it and update your system PATH variable to include the PHP directory.

Verifying Compatibility Before Installing Laravel 12

If you’re installing Laravel 12 using Composer, you can confirm your PHP version meets the requirement by running:

composer create-project laravel/laravel example-app "^12.0"

If your PHP version is below 8.2, Composer will show an error similar to:

Your PHP version (8.1.12) does not satisfy that requirement.

Upgrade your PHP installation, and rerun the command.

Summary

  • Required PHP version: 8.2 or higher
  • Reason: Laravel 12 uses new PHP 8.2 language features
  • Check PHP version: php -v
  • Check required PHP for any version: View the composer.json in the respective Laravel branch on GitHub
  • Upgrade: Use your OS-specific package manager or installer

Always ensure your environment meets Laravel’s minimum requirements to avoid compatibility issues and to take advantage of the framework’s full potential.

Nabil Hassen
Nabil Hassen
Full Stack Web Developer

Stay Updated.

I'll you email you as soon as new, fresh content is published.

Thanks for subscribing to my blog.

Latest Posts