← ALL ARTICLES

· Composer · PHP · Laravel

Composer 2.11 dependency cooldowns for Laravel apps

Composer 2.11 can hold back brand-new package releases for a set period. Why that blunts supply-chain attacks, and how to turn it on in a Laravel app.

Composer 2.11, released on 29 October 2026, adds a dependency cooldown policy: a setting that stops composer update from installing a package version until it has been public for a period you choose. It's sometimes called a minimum release age. It isn't on by default, so if you look after a Laravel app (or any PHP project) and want some protection against a hijacked package release landing in your lock file the day it's published, you need to turn it on yourself. Here's why it helps, how to set it up, and the trade-offs.

Why waiting helps

The Packagist team are clear about the threat this addresses. In the 2.11 release post they say most malicious releases they've seen on Packagist.org in recent months were published by attackers who briefly gained control of a legitimate package, for example through a compromised GitHub account. Earlier this year they also wrote about the wider supply-chain work on Composer and Packagist.

That kind of attack relies on speed. A poisoned version of a popular package is tagged, and every project that runs composer update before anyone notices pulls it in. But, as the release post points out, automated malware scanners can flag the first problems within minutes of a release. A cooldown means your project simply isn't in the queue during that window. You don't need to spot the attack yourself; you only need to be a little slower than the people who do.

The cost is that you get new releases a little later. For most application dependencies that's no loss at all: very few teams need a minor release of a logging library within hours of it being tagged.

Turning it on

The setting lives under config.policy.cooldown in composer.json, alongside Composer's other dependency policies (security advisories, abandoned packages and malware). First make sure you're on 2.11 or later:

composer self-update
composer --version

Then add a period to your project's composer.json. In a Laravel app there's already a config section, so it goes in there:

{
    "config": {
        "optimize-autoloader": true,
        "preferred-install": "dist",
        "sort-packages": true,
        "policy": {
            "cooldown": {
                "period": "3 days"
            }
        }
    }
}

The period is a number and a unit (second, minute, hour, day or week, singular or plural), such as "24 hours" or "1 week", or a plain number of seconds. Vague values like "tomorrow" are rejected. The default is null, meaning no cooldown. The Packagist team suggest anything from a few hours up to a day; I've gone longer in the example because, for a typical app that's updated every week or two, three days costs nothing.

Because it's in composer.json, the policy is committed with the project and applies to everyone on the team and to CI, rather than depending on someone's local Composer config.

What it actually does

The cooldown applies when Composer is choosing versions: composer update, require and remove. When require, init or create-project pick a version constraint for you, they skip versions that are still cooling down. composer outdated and composer show --latest report the newest version you're allowed, and outdated marks releases still in cooldown with a c and shows how long they have left.

A few things are never held back: dev versions like dev-main, platform packages such as php and extensions, locked packages you aren't updating in a partial update, and versions with no publication date at all.

Importantly, composer install from a lock file isn't affected. Your deploys keep installing exactly what's locked. That's the right design: the risky moment is when a new version first enters your lock file, and that only happens during an update. It does mean that if your deploy pipeline runs composer update rather than composer install, you have a bigger problem than cooldowns.

The timing comes from a published-time field that Packagist.org provides for every version. It's recorded by the registry rather than written by the package author, which matters: a release can't simply claim to be older than it is.

Exceptions, and security fixes

Sometimes you do want a release straight away. Composer gives you a few ways round it, from most to least specific.

For packages you trust, such as your own company's, add them to ignore, with a reason. It supports wildcards:

{
    "config": {
        "policy": {
            "cooldown": {
                "period": "3 days",
                "ignore": {
                    "mycompany/*": "Our own packages, released by us"
                }
            }
        }
    }
}

For a one-off, pass --no-cooldown to update, require or remove. The CLI docs say it disables the cooldown blocking for that command while other policies still apply, so packages with known advisories or flagged as malware are still blocked. That's a safer escape hatch than --no-blocking, which turns off all policy blocking.

You can also override the period with an environment variable, which is handy in scripts:

# Skip the cooldown for this run
COMPOSER_POLICY_COOLDOWN_PERIOD=0 composer update laravel/framework

# Use a shorter period for this run
COMPOSER_POLICY_COOLDOWN_PERIOD="24 hours" composer update

The awkward case is security releases. You want a fix for a vulnerability now, but a release that claims to be a security fix is exactly what an attacker would publish. The release post says plainly that Composer cannot safely let security fixes skip the cooldown automatically, so it doesn't. When an advisory lands for something you use, check it, then update that package with --no-cooldown:

composer audit
composer update symfony/http-foundation --with-dependencies --no-cooldown

Doing it this way keeps the bypass narrow: one package, one deliberate decision, rather than switching the whole policy off when it gets in the way.

Private repositories and Satis

If you pull packages from somewhere other than Packagist.org, check it provides publication times. Composer needs a published-time for every version it considers, and if a Composer repository doesn't supply one, the command fails and names the package. For repositories that can't (the docs mention ones generated by Satis), you can set require-published-time to false on that repository, and Composer falls back to each package's time field:

{
    "repositories": [
        {
            "type": "composer",
            "url": "https://packages.example.org",
            "require-published-time": false
        }
    ]
}

Be aware that time is set by the package author, so it's weaker protection. VCS, path and artifact repositories always use the fallback. Private Packagist can also set a cooldown across a whole organisation.

What I'd do

  • Upgrade to Composer 2.11 locally, in CI images and anywhere else composer update runs.
  • Add a cooldown to every app's composer.json. A day is a sensible minimum; a few days is fine for most apps.
  • Only ignore packages you control. It's tempting to exempt laravel/* to get framework releases quickly, but popular packages are exactly the ones attackers want.
  • Make --no-cooldown your security-fix routine: read the advisory, update just that package, and let the cooldown cover everything else.
  • Keep deploying with composer install from a committed lock file, and review lock file changes in pull requests, just as you'd review changes to GitHub Actions workflows.

It's a two-line change, and it closes off one of the most common ways malicious code has reached PHP projects recently.

Sources