Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages
Node.js, PHP and APIs

composer require laravel/passport stops with 'requirements could not be resolved'

ErrorYour requirements could not be resolved to an installable set of packages.

Short answer

Composer found no Passport release that fits your project at once. Each Passport line lists the Laravel (illuminate) range, PHP version and PHP extensions it needs in its composer.json. Ask Composer what blocks it with composer prohibits, then match Passport to your Laravel version, PHP version and extensions, or upgrade the one that is too old.

  • Applies to Laravel 12, Laravel 13, PHP 8.3, Composer 2
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Fix it fast

  1. 1Find out which cause you have

    Read the problem lines under the message. They name the package that conflicts, and the Passport version Composer tried. Then ask Composer directly what keeps a given Passport version out of your project, and list the PHP version and extensions it sees.

    composer prohibits laravel/passport 13.0
    composer show --platform
  2. 2Match what you see, then jump to its fix

    1. 1The problem lines mention illuminate/auth or illuminate/support and a constraint such as ^12.0|^13.0 that your laravel/framework does not satisfyYour Laravel version is outside the range of the Passport lineFix
    2. 2The problem lines say laravel/passport requires php ^8.2 (or another constraint) and your version is lowerThe PHP version that runs Composer is older than the Passport line needsFix
    3. 3The problem lines say laravel/passport requires ext-openssl or ext-json, and the extension is missing from your systemA PHP extension the Passport line requires is missing for the CLIFix
    4. 4The problem lines point at symfony/console, firebase/php-jwt, league/oauth2-server or symfony/psr-http-message-bridge at a version the lock file holdsAnother installed package pins a dependency Passport sharesFix

What does the error look like?

  • Your requirements could not be resolved to an installable set of packages.
  • ... but these were not loaded, likely because it conflicts with another require.

Cause 1 of 4

Your Laravel version is outside the range of the Passport line

1Check

Every Passport line states the illuminate versions it supports. The current line requires illuminate packages ^12.0 or ^13.0 and PHP ^8.2, while the 10.x line asks for ^8.37 or ^9.0. A Laravel 8 project cannot take the current line.

composer show laravel/framework | grep versions
composer prohibits laravel/passport 13.0

2Fix

Pick the Passport line whose composer.json lists your Laravel version, or upgrade Laravel. Read the require section on the matching branch of the laravel/passport repository, then name that line in the command.

# a Laravel 8 project: the 10.x line lists illuminate ^8.37|^9.0
composer require laravel/passport:^10.0

# a current Laravel 12 or 13 project
composer require laravel/passport

3Verify

Composer resolves, installs Passport and writes it to composer.json.

composer show laravel/passport

Confirmed by raw.githubusercontent.com

Did this fix it?

Cause 2 of 4

The PHP version that runs Composer is older than the Passport line needs

1Check

Composer checks the requirements against the PHP that runs it, which can differ from the PHP your web server uses. The current Passport line asks for PHP ^8.2.

php -v
composer show --platform | grep -E "^php "

2Fix

Run Composer with a PHP version that satisfies the line, or choose an older Passport line that allows your PHP. Do not force the install with --ignore-platform-reqs, which Composer documents as ignoring all platform requirements.

# use the PHP you mean, for example from the full path
/usr/bin/php8.3 /usr/local/bin/composer require laravel/passport

3Verify

composer show --platform lists the PHP version you expect, and the require succeeds.

composer show --platform | grep -E "^php "

Confirmed by getcomposer.org

Did this fix it?

Cause 3 of 4

A PHP extension the Passport line requires is missing for the CLI

1Check

The current Passport line requires ext-json and ext-openssl. Composer reads the extensions of the PHP that runs it, and the command-line PHP can load a different set from the web server's.

php -m | grep -i -E "openssl|json"
composer show --platform | grep -E "^ext-(openssl|json)"

2Fix

Enable the extension for the command-line PHP, then run the command again. Ignoring the requirement with --ignore-platform-req is only for a test.

php --ini
# enable openssl in the php.ini that php --ini prints for the CLI

3Verify

The extension shows in the platform list, and the require succeeds.

composer show --platform | grep -E "^ext-openssl"

Confirmed by getcomposer.org

Did this fix it?

Cause 4 of 4

Another installed package pins a dependency Passport shares

1Check

The current Passport line also requires league/oauth2-server ^9.2, firebase/php-jwt ^6.4 or ^7.0, symfony/console ^7.1 or ^8.0 and symfony/psr-http-message-bridge ^7.1 or ^8.0. If another package, or your lock file, holds one of them at an older version, Composer cannot place Passport.

composer prohibits laravel/passport 13.0
composer show | grep -E "symfony/console|firebase/php-jwt|league/oauth2-server|psr-http-message-bridge"

2Fix

Let Composer update the shared dependencies together with Passport. The -W option updates the dependencies of the named packages, including root requirements.

composer update laravel/passport -W

3Verify

Composer completes without the message, and Passport appears in the lock file.

composer show laravel/passport

Confirmed by getcomposer.org

Did this fix it?

How do I stop it coming back?

  • Read the require section of a package's composer.json before you pick a line for an older Laravel version, so the constraint is known in advance.
  • Run composer prohibits <package> <version> when a message is unclear. It names the packages in the way.
  • Keep the CLI PHP and the web PHP on the same version, and check the extensions with composer show --platform.
  • Update Laravel and Passport together on a planned upgrade, and commit composer.lock afterwards.

Sources

How was this page made?

I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.

Which stack is behind this page?

Projects of mine built on the same technologies:

Related fixes

Back end

composer require maatwebsite/excel fails to install

Composer says the package needs an older PHP than the one installed

Composer refuses maatwebsite/excel when the PHP version or a PHP extension does not match what the package and PhpSpreadsheet need.

3 causes, each with a fix

Back end

composer require laravel/horizon fails: ext-pcntl is missing

laravel/horizon v1.1.0 requires ext-pcntl * -> the requested PHP extension pcntl is missing from your system

Horizon needs the pcntl extension, and Composer refuses to install it where PHP lacks that extension.

3 causes, each with a fix

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.