Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is SymfonyRequirements.php excluded from .gitignore?

If I understand it correctly, the SymfonyRequirements.php file (which lives under /app or /var depending on Symfony version) is handled by Composer. I therefore suppose it should be not be tracked by any version control system. However, I see it is excluded from Symfony Standard Edition's .gitignore file:

/var/*
[...]
!var/SymfonyRequirements.php

Edit

Symfony core developer @Stof says in a Github issue:

given that one of the checks is whether you installed vendors, it must be there before installing them (even though we have an automatic update of the requirements so that you check the uptodate ones next time).

This is not very clear to me. Can anybody give any more details about this file and explain why it should or should not be tracked by a VCS?

like image 217
marcv Avatar asked Feb 10 '16 12:02

marcv


2 Answers

This file is used by Symfony Check CLI Script to check for minimum requirements of configuring & running a Symfony App. It's a Common Post-Deployment Task.

It checks for current PHP Version/Configurations(php.ini settings) and required PHP Extensions. For example it checks for current setting of date.timezone.

What @stof is trying to say is that you should be able to run the checks even before installing dependencies using composer install. It even checks for dependencies installation itself: checks for existence of vendor/composer directory.

It gives you a good & enough insight about whether the Symfony App has what it needs to be run based on Current PHP configuration.

Note that by adding this file to VCS, you should know there may be changes to this file after updating dependencies later using composer update. So you should remember to commit this file too!.

Please Note that these checks also provide some recommendations(not requirements) to be set. For Example check this recommendation out:

When using the logout handler from the Symfony Security Component, you should have at least PHP 5.4.11 due to PHP bug #63379 (as a workaround, you can also set invalidate_session to false in the security logout handler configuration)

Some other Projects using Symfony also implement their own checks by extending this file, For example checkout Oro Platforms Requirements Check.

like image 105
slashsbin Avatar answered Oct 20 '22 10:10

slashsbin


The files is used in the check CLI tool that use this files for control the minimal Requirements for Running Symfony. You can find more info in the doc.

Usually is take into account in a version control system, as you can see in the symfony-standard distribution project on github:

https://github.com/symfony/symfony-standard

(of course you can add the files in your custom .gitignore files)

For more precision, this file is used in the command php bin/symfony_requirements in symfony3 and php app/check.php for older, that checks your php/symfony requirements.

See this question Should the changes of SymfonyRequirements.php be included in version control? and the documentation.

like image 42
chalasr Avatar answered Oct 20 '22 12:10

chalasr