vet README

README проекта с github.com/laravel/vet. Одним файлом markdown: README.md.

Vet example

[!WARNING] Laravel Vet is archived and gets no more updates. Composer now does this work itself. Read Moving To Composer.

Laravel Vet is a dependency audit for PHP. It shows you the code that composer update is about to write into vendor/, and records the packages you trust in a vet.json file.

Vet runs as a Composer plugin, on every install and update, in any PHP project:

❯ composer update

  to review (1)

  carbonphp/carbon-doctrine-types 3.1.0 → 3.2.0 ............... 1 file changed
  │
  │   ~ src/Carbon/Doctrine/DateTimeType.php
  │     @@ -17,7 +17,7 @@
  │     -    public function convertToPHPValue(mixed $value, AbstractPlatform $platform): ?DateTime
  │     +    public function convertToPHPValue(mixed $value, AbstractPlatform $platform): ?Carbon
  │

  Packages: 1 to review, 124 trusted

   ERROR  [1] package is not trusted. Read every change with [./vendor/bin/vet -v]. Run [./vendor/bin/vet] in a terminal to pick the ones that you trust.

Moving To Composer

Starting with Composer ^2.11, Composer holds back each release younger than a period you choose. Update Composer to the latest version:

composer self-update

Next, move minimum-release-age and minimum-release-age-exclude from vet.json into composer.json:

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

Composer also blocks each version that Packagist.org flags as malware. Packagist.org takes these flags from Aikido. The block is on by default.

Then remove Vet:

composer remove laravel/vet --dev
rm vet.json

Installation

Requires PHP 8.4+.

You can install Laravel Vet via Composer:

composer require laravel/vet --dev

Next, record the packages you trust today. The --minimum-release-age option holds back every release younger than 7 days:

./vendor/bin/vet --init --minimum-release-age=7
   INFO  Trusted [125] packages, and wrote [vet.json].

   WARN  Vet now holds back each release younger than [7] days. Run [composer update] again to move each package to a release that is old enough.

Run composer update once more, and Composer moves each package to the newest release that is old enough. Commit vet.json.

Auditing Your Dependencies

Run vet to see where you stand:

./vendor/bin/vet
   INFO  All [125] packages are trusted.

Vet exits with a non-zero status when a package is not trusted, so a package that nobody has read fails your build. In a terminal, vet then asks which packages you trust:

 ┌ Which packages do you trust? ────────────────────────────────┐
 │ ◼ acme/logger   1.2.0 → 2.0.0                                │
 │ ◻ acme/tooling  4.1.0 → 4.2.0                                │
 └──────────────────────────────────────────────────────────────┘

   INFO  Recorded [acme/logger] [2.0.0] at [8002bb9cf6c9].

To read every change of one package, pass its name:

./vendor/bin/vet acme/logger

Reviewing With Your Agent

In a terminal, vet asks how you want to review. Pick your coding agent, and it reads the changes of each package and reports back. The agent reads, and you decide:

  acme/logger 1.2.0 → 2.0.0 ................................. 12 files changed
  │  FAIL   src/Ship.php reads .env and sends it to an unknown host

  carbonphp/carbon-doctrine-types 3.1.0 → 3.2.0 .............. 2 files changed
  │  PASS   the changes narrow two return types

PASS means the agent read every file and found no attack. FAIL names each file and the reason. WARN means part of the reading is yours, such as a file too big for the prompt. Vet picks every PASS package in the list for you, so one enter records them, and you read the rest.

The agent runs only when you ask for it. The Composer plugin never asks.

The Trust File

vet.json holds one entry for each package: the version you read, and the hash of its files. When a package ships the same version with different bytes, vet asks you to read the difference:

{
    "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"
        ]
    }
}

minimum-release-age is the number of days a release waits before vet lets it in. A release younger than that fails the audit, even one you trust. Packages under minimum-release-age-exclude skip the wait, and * matches any part of a name. Vet itself always skips it.

ignore lists the paths that a tool rewrites inside vendor/ on purpose, such as the configuration files that Laravel Vapor changes during a deploy. Vet leaves them out of the hash and out of the changes.

To start the trust file again, run ./vendor/bin/vet --fresh. It clears every entry, keeps your settings, and records what vendor/ holds today.

Contributing

Thank you for considering contributing to Laravel! The contribution guide can be found in the Laravel documentation.

Code of Conduct

In order to ensure that the Laravel community is welcoming to all, please review and abide by the Code of Conduct.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

License

Laravel Vet is open-sourced software licensed under the MIT license.

vet (laravel/vet)

Ищем в базе…

186 ·GitHub
Что это такое?Laravel Vet — это аудит зависимостей для PHP: он показывает вам код, который composer update собирается записать в вашу папку vendor/, и сохраняет доверенные вами пакеты в файле vet.json, так что каждое следующее обновление спрашивает только о том, что изменилось.
Это работает только с Laravel или подходит любому PHP-проекту?Любому PHP-проекту с composer.json: Laravel, Symfony, WordPress или чистый PHP. Несмотря на название, это плагин для Composer, а не что-то специфичное для Laravel.
Нужен ли мне ИИ-агент, чтобы проверка состоялась?Нет — вы можете прочитать изменения в зависимостях сами. Если ИИ-агент для кодинга уже стоит на вашей машине (Claude Code, Codex, Gemini, opencode), первый вопрос в терминале предложит его, и он просмотрит каждый пакет, а финальное слово останется за вами.
Это стабильный инструмент?Пока нет — он в бета-версии, и README предупреждает, что поведение может измениться до первого стабильного релиза.
Мой код покидает мою машину?Только когда вы сами запросите проверку агентом. Vet показывает количество запросов и их общий размер перед отправкой первого, плагин для Composer никогда не запускает агент по своей инициативе, и в vet.json ничего не записывается, пока вы не ответите.
Идея пришла из другой экосистемы?Да — cargo vet из мира Rust. В README Laravel Vet описывается как та же идея для Composer: посмотреть, что добавит обновление, до того как оно попадёт в проект, а затем зафиксировать, каким пакетам вы доверяете.
Какие вердикты может выдать ИИ-агент?Четыре: PASS — все файлы прочитаны и атак не найдено; FAIL — с перечнем файлов и причин; WARN — часть не удалось прочитать (слишком большой файл или .phar), а остальное остаётся на вас; SKIP — ничего не изменилось или отправить проверку не удалось.
Что произойдёт в CI, если пакету нет доверия?Процесс завершится с ненулевым кодом возврата и сборка упадёт, пока кто-нибудь не изучит пакет и не пометит его доверенным. Без терминала vet только записывает отчёт и ничего не спрашивает.
Что происходит при самом первом запуске?Пока файла vet.json нет, vet ничего не проверяет, поэтому первый шаг — ./vendor/bin/vet --init: он записывает все пакеты, которые сегодня лежат в vendor/, как доверенные. Вместо этого можно использовать --fresh, чтобы начать с пустого файла доверия, а когда vet.json появится — закоммитьте его.
Какие есть похожие проекты?bashka, composer, desloppify, osv-scanner, gh-actions-lock, semgrep, psalm, mantis
Автор
laravel
Размер
73.5 MB
Звёзды
186
Возраст
3 мес
Коммиты · 90 дней