我已经使用命令创建了一个项目
composer create-project symfony/website-skeleton my_project_name
我想安装
symfony/profiler-pack
。为什么?因此,分析器中没有“调试”选项卡。
我尝试过使用
composer require --dev symfony/profiler-pack
,输出是
Using version ^1.0 for symfony/profiler-pack
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Restricting packages listed in "symfony/symfony" to "5.1.*"
Package operations: 1 install, 0 updates, 0 removals
As there is no 'unzip' command installed zip files are being unpacked using the PHP zip extension.
This may cause invalid reports of corrupted archives. Besides, any UNIX permissions (e.g. executable) defined in the archives will be lost.
Installing 'unzip' may remediate them.
- Installing symfony/profiler-pack (v1.0.5): Loading from cache
Writing lock file
Generating optimized autoload files
composer/package-versions-deprecated: Generating version class...
composer/package-versions-deprecated: ...done generating version class
90 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
Executing script cache:clear [OK]
Executing script assets:install public [OK]
Unpacked symfony/profiler-pack dependencies
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Package operations: 0 installs, 0 updates, 1 removal
- Removing symfony/profiler-pack (v1.0.5)
89 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
为什么
symfony/profiler-pack
安装后就被删除了?
我的
composer.json
的一部分:
"require-dev": {
"symfony/browser-kit": "^5.1",
"symfony/css-selector": "^5.1",
"symfony/debug-bundle": "^5.1",
"symfony/maker-bundle": "^1.0",
"symfony/monolog-bundle": "^3.0",
"symfony/phpunit-bridge": "^5.1",
"symfony/stopwatch": "^5.1",
"symfony/twig-bundle": "^5.1",
"symfony/var-dumper": "^5.1",
"symfony/web-profiler-bundle": "^5.1"
}
*-pack
Symfony 软件包是“元软件包”,安装后它们总是被“删除”
它们的唯一目的是同时安装一堆一级相关依赖项,有时还执行一些 Flex 配方。
当您
require profiler-pack
时,实际添加到您的依赖项中的是:
"symfony/stopwatch": "5.1.*",
"symfony/twig-bundle": "5.1.*",
"symfony/web-profiler-bundle": "5.1.*",
您可以在Packagist上检查确认这一点。
或者例如,如果您安装orm-pack
,您将在第一级安装这些(例如,这些现在是您项目的依赖项,而不是包的依赖项):
"composer/package-versions-deprecated": "^1.11",
"doctrine/doctrine-bundle": "^2.1",
"doctrine/doctrine-migrations-bundle": "^3.0",
"doctrine/orm": "^2.7",
过去,这些软件包作为第一级依赖项安装,除非您将 --unpack
标志传递给
require
,或者在安装后执行
unpack
。现在这些包默认解压,这更好,因为否则“真正的”依赖项隐藏在 Symfony“元包”后面。安装后
profiler-pack
被移除是完全正常的行为。您不能保留该软件包,而且它也不会带来任何运行时功能。
msg 所解释的那样。它由 symfony/debug-bundle
提供,您似乎已经安装了。尽管安装了,但它似乎不存在,您的安装可能由于某种原因而过时。
bundles.php
文件中未启用该捆绑包。确保它在那里:
Symfony\Bundle\DebugBundle\DebugBundle::class => ['dev' => true, 'test' => true],