我想从一个项目中获取composer.lock(&.json),然后运行一些测试以查看其中是否有过时的软件包。
composer outdated
似乎要求我先安装所有软件包,
但这有点矫over过正,因为所有必需的信息都应该在composer.lock-file中。
composer install
的情况下找到过时的软件包?我将“ foolz / sphinxql-query-builder”作为一个项目的示例。
composer.json
中有一个require['foolz/sphinxql-query-builder'] = '^1.0'
。composer.lock
中有一个packages[] = {name: foolz/sphinxql-query-builder, version: '1.0.2', ...}
~/.cache/composer/repo/https---packagist.org/p-provider-2018-04.json
中有一个providers['foolz/sphinxql-query-builder']->sha256
~/.cache/composer/repo/https---packagist.org/provider-foolz\$sphinxql-query-builder.json
中有一个packages['foolz/sphinxql-query-builder']->$version
从该文件中我可以运行
array_keys((array) $json->packages->{'foolz/sphinxql-query-builder'})
以获得可用版本的列表。
答案 0 :(得分:0)
"laravelium/sitemap": "^3.0",
但是在composer json中存在此信息
{ "name": "laravelium/sitemap", "version": "v3.0.1", "source": { "type": "git", "url": "https://gitlab.com/Laravelium/Sitemap.git", "reference": "b287ec4a6b47dcd63fd121199c05e059c479bc6f" }, "dist": { "type": "zip", "url": "https://gitlab.com/api/v4/projects/Laravelium%2FSitemap/repository/archive.zip?sha=b287ec4a6b47dcd63fd121199c05e059c479bc6f", "reference": "b287ec4a6b47dcd63fd121199c05e059c479bc6f", "shasum": "" }, "require": { "illuminate/support": "5.7.*", "php": ">=7.1.3" }, "require-dev": { "orchestra/testbench": "3.7.*", "phpunit/phpunit": "~7.0" }, "type": "library", "extra": { "laravel": { "providers": [ "Laravelium\\Sitemap\\SitemapServiceProvider" ] } }, "autoload": { "psr-0": { "Laravelium\\Sitemap": "src/" } }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], "authors": [ { "name": "Roumen Damianoff", "email": "roumen@damianoff.com", "homepage": "https://damianoff.com", "role": "Developer" } ], "description": "Laravelium Sitemap package for Laravel.", "homepage": "https://laravelium.com", "keywords": [ "Sitemap", "generator", "google-news", "html", "laravel", "laravelium", "php", "xml" ], "time": "2018-09-04T19:08:44+00:00" },
请注意,您将安装版本v3。{\ d +}(> = 3 && <4)(如果存在),并且新标记版本可能具有不兼容的更改
composer show -l
返回软件包列表。可以更新红色的软件包,而绿色是最新版本。 尽管如此,您还是需要继续composer install
,因为只有这样,您才能了解已安装软件包的确切版本