Newest symfony installer vs composer

只愿长相守 提交于 2021-02-06 08:50:51

问题


I'd like to know whats the difference when creating new symfony project with new symfony installer that has appeared last time and old-way composer.

I've installed latest version of symfony (2.6.1) with both, and result was different, for example when I install symfony with composer, i get .gitignore file. When I install with new symfony installer script, gitignore is missing.

Here is amount of catalogs and files in fresh project:

symfony installer:                      1498 directories, 7136 files
symfony installer + composer update:    1571 directories, 7749 files
composer create-project:                1615 directories, 7905 files

I suppose I'll stick to old way - composer, since new installer seems to be bugged or at least not complete yet, however I'd like to understand more on this topic, whats the difference, is it safe to use new installer etc?


回答1:


As Leggendario already explained, the installer downloads the dist files from the website (a .tar.gz or .zip file). This speeds up the installation process quite a bit.

However, when building the dist files, symfony.com uses a custom build script which removes some files and changes some things. On the other hand, composer simply downloads the repository for you.

The main differences:

  • Composer downloads the latest dependencies (as Leggendario pointed out), while the build script contains the latest files at the moment of building.
  • Composer uses the dev versions and thus uses git clone to download the packages. The build script uses only stable packages, which will make Composer use the dist version. Some packages remove test and doc files from their dist files.
  • Composer contains all project related information, like a .gitignore. The build script previously assumed the person installing it didn't have git, so removed this file and other git related files like the .gitkeep files in app/cache and app/logs.

I any case, both the installer and composer always give you a working version of the Symfony Standard Edition.

At last, the build script was changed now the installer became the official way of installing. It'll now contain the git related files. On the other hand, it'll not contain the LICENSE file, UPGRADE-*.md files and README.md file. So in the end, we can say that the one installed by the installer is more usable, as it removes useless files.




回答2:


Symfony2 Installer will downloaded it from the web site ( in this case: http://symfony.com/download?v=Symfony_Standard_Vendors_2.6.1.zip ).

To see the differences between symfony installer and the classic composer create-project is enough to take a look at both composer.lock: https://www.diffchecker.com/oig86oki

On the left the composer.lock generated after composer create-project, on the right symfony installer. It was obvious to everyone that Symfony2 downloaded from an archive could not have the lastest packages. So, do the update with composer update.

Again, on the left the composer.lock of composer create-project, on the right the new composer.lock after the update: https://www.diffchecker.com/lj5j2eap

As we expected. But in the vendor dir there are not the same number of file. Some folders are not there. Some folders with functional tests are not downloaded with symfony installer. You need to force composer to update all packages, or reinstall them.




回答3:


Did you update installer as well with :

symfony self-update

or in windows :

php symfony.phar self-update

As stated here ?

That's perhaps one part of the answer. Among differences, the installer seems to deal better with different symfony versions.



来源:https://stackoverflow.com/questions/27765895/newest-symfony-installer-vs-composer

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!