composer dump autoload and git

亡梦爱人 提交于 2019-12-13 02:42:44

问题


We have decided to commit the vendor directory inside our git repo for deployment practicality. Things are working however everytime we run composer dump-autoload it modifies the following files which is quite annoying as it doesn't seem to represent a specific state of files it looks like a random number every time you re-run it. How should I handle this?

vendor/autoload.php

return ComposerAutoloaderInit54ff9d13a4342a89ea5000269df2222::getLoader();

vendor/composer/autoload_real.php

spl_autoload_register(array('ComposerAutoloaderInit54ff9d13a4342a89ea5000269df2222', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
spl_autoload_unregister(array('ComposerAutoloaderInit54ff9d13a4342a89ea5000269df2222', 'loadClassLoader'));

Git detects these as changed but I can't see any changes at all, it even says 0 lines added, 0 lines removed

vendor/composer/ClassLoader.php

vendor/composer/autoload_classmap.php

vendor/composer/autoload_files.php

vendor/composer/autoload_namespace.php

vendor/composer/include_paths.php


回答1:


To my knowledge it is not advisable to use previous Composer Autoload files. I tried it once, since I was using Beanstalkapp + it's deployment feature but rather quickly I found out that it wasn't such a brilliant idea since nothing was loaded and I was getting some major errors.

Maybe it's an idea to not include the vendor folder at all and only do those composer updates on the deployment server itself.

And as a quick tip, you generally don't want to update your Composer packages on a live server. Some things might break and it'll cause you a headache to fix.



来源:https://stackoverflow.com/questions/20306302/composer-dump-autoload-and-git

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