symfony/profiler-pack (or symfony/orm-pack, or some other symfony/*-pack package) is being removed right after installation
Asked Answered
M

1

11

I have created a project using command composer create-project symfony/website-skeleton my_project_name

I want to install symfony/profiler-pack. Why? Because of that there is no "Debug" tab in the profiler.

enter image description here

I have tried using composer require --dev symfony/profiler-pack, and the output is

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!

Why symfony/profiler-pack is being removed right after installation?

Part of my 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"
}
Maestoso answered 2/9, 2020 at 18:45 Comment(1)
Comments are not meant for extended discussion. Please take any issues you have with out community editing rules to Meta Stack Overflow.Assist
F
15

The *-pack Symfony packages are "meta-packages", and they are always "removed" after installation

Their only purpose is to install a bunch of first-level related dependencies at the same time, and sometimes execute some flex recipes.

When you require profiler-pack, what's actually added to your dependencies is:

"symfony/stopwatch": "5.1.*",
"symfony/twig-bundle": "5.1.*",
"symfony/web-profiler-bundle": "5.1.*",

You can check confirm this on packagist.

Or for example, if you install orm-pack you'll get these installed at the first level (as in, these are now your project's dependencies, not the pack's dependencies):

"composer/package-versions-deprecated": "^1.11",
"doctrine/doctrine-bundle": "^2.1",
"doctrine/doctrine-migrations-bundle": "^3.0",
"doctrine/orm": "^2.7",

In the past these packages were left installed as first level dependencies, unless you passed the --unpack flag to require, or that you executed unpack after installation. Now these packs are unpacked by default, which is better because otherwise the "real" dependencies were hidden behind the Symfony "meta-pack".

The fact that the profiler-pack is removed after installation is completely normal behaviour. You can't keep that package around, and it doesn't bring any runtime features anyway.


The "Debug" tab you are looking for is provided by a different package, as explained by msg in the comments. It's provided by symfony/debug-bundle, which you already seem to have installed. Seems it's not there despite the installation, your installation may be stale for some reason.

But more likely, the bundle is not enabled in your bundles.php file. Make sure that this is there:

Symfony\Bundle\DebugBundle\DebugBundle::class => ['dev' => true, 'test' => true],
Flabby answered 3/9, 2020 at 6:25 Comment(6)
You can see "Debug" tab here on the first screenshot. I'm totally sure that "Debug" tab is present in Symfony 4.*.Maestoso
True, is there in that screenshot. No idea what's behind it though. But it's completely unrelated with "profiler-pack" being removed after installation. I don't have any Sf4 project on this machine to test out I'm afraid.Flabby
@Maestoso The 'Debug' tab is a DataCollector provided by symfony/debug-bundle, and not part of the profiler-pack. You have it declared in the composer snippet you show and should be automatically activated by flex. You can double check config/bundles.php, try clearing the cache or removing symfony.lock and running composer install.Vivisect
Thanks @msg. It might sound silly, but I don't think I ever installed that bundle (doing it now just to see what it is about). Do you mind if I incorporate that bit in my answer?Flabby
@Flabby ofc, go right ahead. It just removes the output from dump calls and shows them in that pane (or in the debug bar itself).Vivisect
Oh, make sense I haven't installed it. Not a big dump user. But how knows, I might get into the habit ;) Thanks @VivisectFlabby

© 2022 - 2024 — McMap. All rights reserved.