> ## Documentation Index
> Fetch the complete documentation index at: https://kawax.biz/llms.txt
> Use this file to discover all available pages before exploring further.

# Laravel Vet — Dependency Audit Tool and Migration to Composer

> An investigation of the archived laravel/vet. It covers how vet reviews the changes composer update writes to vendor/, and how to migrate to Composer's built-in cooldown and malware policies.

> [!WARNING]
>
> `laravel/vet` is currently archived and no longer updated. The README recommends migrating to Composer's built-in features. Read this as material for deciding how to handle existing projects, not as a guide for new adoption.

## What Vet is

[Laravel Vet](https://github.com/laravel/vet) is a dependency audit tool for PHP. It runs as a Composer plugin that shows the changes `composer update` is about to write into `vendor/`, package by package, and lets you approve them before Composer writes. Packages you trust are recorded in `vet.json`, so the next update only asks you about what changed.

It requires PHP 8.4 or later.

## The problem it addresses

When Composer fetches a dependency, it writes the contents into `vendor/` without anyone reading them. In a supply chain attack, a malicious release published shortly before an automatic update can get in. Vet guards against this from two directions.

* **Read before it lands**: review the diff of each changed file before it is written
* **Wait for new releases**: exclude releases younger than a set number of days from candidates

## How it works

```mermaid theme={null}
flowchart LR
    A["composer update"] --> B["Filter by release age<br>PRE_POOL_CREATE"]
    B --> C["Check untrusted packages<br>PRE_OPERATIONS_EXEC"]
    C -->|trusted| D["Write to vendor/"]
    C -->|untrusted| E["Stop with an error<br>Review with vet"]
```

`src/Composer/Plugin.php` subscribes to these events.

* `PRE_POOL_CREATE`: removes releases younger than the configured age from the candidates (`minimum-release-age`)
* `PRE_OPERATIONS_EXEC`: checks untrusted packages before installation
* `POST_INSTALL_CMD` / `POST_UPDATE_CMD`: runs the audit after install and update

## Installation and setup

```shell theme={null}
composer require laravel/vet --dev
./vendor/bin/vet --init --minimum-release-age=7
composer update
```

`vet --init` records every currently installed package as trusted and creates `vet.json`. With `--minimum-release-age=7`, releases younger than seven days are excluded from candidates. Running `composer update` afterward moves each package to the newest release that is old enough. Commit `vet.json`.

## Daily auditing

```shell theme={null}
./vendor/bin/vet
./vendor/bin/vet acme/logger
```

The first command exits with a non-zero status when a package is not trusted. In a terminal, it asks interactively which packages to trust. The second command shows every change for one package.

## Reviewing with an agent

When you run vet in a terminal, it can ask one of these coding agents to read the changes.

* Claude
* Codex
* Gemini
* opencode

The agent reads each package's changes and returns `PASS` or `FAIL`. `WARN` means part of the review is left to a person, for example when a file is too large for the prompt. According to the README, the agent reads and you decide. The agent is never called from the Composer plugin. It runs only when you ask for it.

## The vet.json structure

```json theme={null}
{
    "require": {
        "carbonphp/carbon-doctrine-types": {
            "version": "3.2.1",
            "hash": "tree-v2:0f158f3b909fc01e691ed5f5121186056232b049031e7d3a914676d49881ece5"
        }
    },
    "require-dev": { … },
    "minimum-release-age": 7,
    "minimum-release-age-exclude": [
        "laravel/*"
    ],
    "ignore": {
        "laravel/framework": [
            "config/cache.php"
        ]
    }
}
```

* `require` and `require-dev`: the version you reviewed and a hash of its files. If the same version ships different bytes, vet asks you to review the difference again.
* `minimum-release-age`: the number of days a release waits before it is allowed.
* `minimum-release-age-exclude`: packages exempt from the wait. `*` matches any part of a name.
* `ignore`: paths that a tool rewrites inside `vendor/` on purpose, such as configuration files that Laravel Vapor changes during deployment. They are left out of the hash and the diffs.

To reset the trust records, run `./vendor/bin/vet --fresh`. It keeps your settings and records what `vendor/` contains now.

## Migrating to Composer

The README says that from Composer `^2.11`, Composer handles this work itself, and recommends the following migration.

1. Update Composer to the latest version

   ```shell theme={null}
   composer self-update
   ```

2. Move `minimum-release-age` and `minimum-release-age-exclude` from `vet.json` into `composer.json`

   ```json theme={null}
   {
       "config": {
           "policy": {
               "cooldown": {
                   "period": "7 days",
                   "ignore": {
                       "laravel/*": "We trust the Laravel packages"
                   }
               }
           }
       }
   }
   ```

3. Remove Vet

   ```shell theme={null}
   composer remove laravel/vet --dev
   rm vet.json
   ```

The behavior of these settings in Composer's official documentation ([`doc/06-config.md`](https://github.com/composer/composer/blob/main/doc/06-config.md)) is as follows.

* **`period`**: a string such as `"7 days"` or `"24 hours"`, or an integer number of seconds. Relative phrases such as `"tomorrow"` are rejected.
* **Publication time**: determined from `published-time`, which Packagist.org provides. VCS, path, and artifact repositories fall back to the `time` field.
* **Exempt**: dev versions such as `dev-main`, platform packages, and packages with no publication date.
* **Temporary bypass**: `composer update --no-cooldown` skips the policy for one run. `COMPOSER_POLICY_COOLDOWN_PERIOD=0` also disables it.
* **Malware policy**: enabled by default. Versions flagged as malware are blocked. Packagist.org takes these flags from Aikido.

> [!NOTE]
>
> The README's migration steps only cover `minimum-release-age`. They do not address the hash-based trust records that `vet.json` keeps in `require`. Composer's malware policy is on by default. If you plan to replace Vet's trust records entirely, consider this gap before deciding.

## Summary

Laravel Vet was a Composer plugin that combined per-package diff review with trust records under a "read before it lands" model. It is now archived, and the release waiting period can be handled by Composer's `cooldown`. For new projects, adopting it is no longer the practical choice. It is more useful as a reference for migrating an existing `vet.json` into Composer's configuration.

## Related pages

> [card] [Laravel Doctor](https://kawax.biz/en/blog/laravel-doctor-introduction.md)
>
> Introduces a tool that diagnoses a project's environment and configuration.

> [card] [Laravel Passkeys initial investigation](https://kawax.biz/en/blog/passkeys-introduction.md)
>
> An initial investigation of a passwordless authentication package.

## Primary sources

* [`laravel/vet`](https://github.com/laravel/vet) (default branch `0.x`, archived)
* [README](https://github.com/laravel/vet/blob/0.x/README.md)
* [`composer.json`](https://github.com/laravel/vet/blob/0.x/composer.json) (`abandoned: true`)
* [`src/Composer/Plugin.php`](https://github.com/laravel/vet/blob/0.x/src/Composer/Plugin.php)
* [`app/Enums/AgentType.php`](https://github.com/laravel/vet/blob/0.x/app/Enums/AgentType.php)
* [Composer configuration reference (`config.policy`)](https://github.com/composer/composer/blob/main/doc/06-config.md)


## Related topics

- [Blog](https://kawax.biz/en/blog/index.md)
- [Laravel Doctor — application diagnostics tool](https://kawax.biz/en/blog/laravel-doctor-introduction.md)
- [Upgrading from Laravel 10 to 11](https://kawax.biz/en/blog/upgrade-10-to-11.md)
- [Upgrading from Laravel 9 to 10](https://kawax.biz/en/blog/upgrade-9-to-10.md)
- [Upgrading from Laravel 8 to 9](https://kawax.biz/en/blog/upgrade-8-to-9.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.