Reputation: 349
I'm going through a new test Symfony 5 install right now, and I'm on this section of the docs:
https://symfony.com/doc/5.4/page_creation.html#rendering-a-template
I ran composer require twig
, and it says it's installing it, then when composer runs 'Unpacking Symfony packs', it then states "Removing symfony/twig-pack (v1.0.1)"...
I notice later in my VCS that nothing changed in composer.json and composer.lock, so the command at least didn't change any non-gitignored files. I notice twig/twig
is specified as a dependency for packages all over composer.lock, so maybe it's just using one of those...? I'm a little confused at this point.
So my questions are: Why did it install it if it's already in composer.lock, and why then did it remove it? Am I reading the output wrong?
I think some of the output is from Symfony's composer.json "scripts" section, which was pre-written by running:
composer create-project symfony/skeleton:"^5.4" my_project_directory
cd my_project_directory
composer require webapp
from this page: https://symfony.com/doc/5.4/setup.html#creating-symfony-applications
Relevant pre-existing auto-generated composer.json specs:
"symfony/framework-bundle": "5.4.*",
"symfony/twig-bundle": "5.4.*",
"twig/extra-bundle": "^2.12|^3.0",
"twig/twig": "^2.12|^3.0"
Here's my composer output... sorry for the long post, should be easy to pick out relevant points anyway:
symfony-5 % composer require twig
Using version ^1.0 for symfony/twig-pack
./composer.json has been updated
Running composer update symfony/twig-pack
Loading composer repositories with package information
Info from https://repo.packagist.org: #StandWithUkraine
Updating dependencies
Lock file operations: 1 install, 0 updates, 0 removals
- Locking symfony/twig-pack (v1.0.1)
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 1 install, 0 updates, 0 removals
- Installing symfony/twig-pack (v1.0.1): Extracting archive
Generating optimized autoload files
115 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
Run composer recipes at any time to see the status of your Symfony recipes.
Unpacking Symfony packs
- Unpacked symfony/twig-pack
Loading composer repositories with package information
Updating dependencies
Nothing to modify in lock file
Installing dependencies from lock file (including require-dev)
Package operations: 0 installs, 0 updates, 1 removal
- Removing symfony/twig-pack (v1.0.1)
Generating optimized autoload files
114 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
Run composer recipes at any time to see the status of your Symfony recipes.
Executing script cache:clear [OK]
Executing script assets:install public [OK]
No security vulnerability advisories found
No security vulnerability advisories found
Also, I'm scratching my chin on why "No security vulnerability advisories found" is being outputted twice...
Upvotes: 2
Views: 596
Reputation: 10877
That doc page is just telling you how twig is installed. The beginning of each section of the docs will start out by telling you how the particular subject component is installed. That is because it is common for developers to create their projects with the bare minimum dependencies, and add more only as needed. The components can also be used 'stand-alone' without the Symfony framework. Either way, the logical first step for using twig templates is to make sure you have twig installed, so they show you how to do that first.
You already have it installed if you ran composer require webapp
or you created project with symfony new my_project_directory --version=5.4 --webapp
. The --webapp
option will add common dependencies for traditional web applications including twig.
So, by running composer require twig
with flex it will run a recipe that installs symfony/twig-pack
then adds it's required packages to your required packages if you don't already have them. Then symfony/twig-pack
is no longer needed so it gets removed.
These packs like symfony/twig-pack
only require additional packages. You already have the packages installed so no other actions are needed.
Upvotes: 5