Laravel + git,贡献者有不同的环境

时间:2015-06-01 09:51:00

标签: php git laravel dependencies composer-php

我和我的同事正在尝试使用当地的git repo来完成我们的Laravel项目。 我使用的是Ubuntu,PHP 5.5.9-1ubuntu4.9,他正在使用Debian和PHP 5.4.39。

当我提交他提交的版本时,我在尝试运行composer update时遇到错误:

user@ubuntu:/var/www/frontend$ composer install
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Nothing to install or update
Generating autoload files
PHP Fatal error:  Class 'Illuminate\Support\Arr' not found in /var/www/frontend/vendor/laravel/framework/src/Illuminate/Support/helpers.php on line 182
Script php artisan clear-compiled handling the post-install-cmd event returned with an error   [RuntimeException]                                                                                                                                                            
Error Output: PHP Fatal error:  Class 'Illuminate\Support\Arr' not found in /var/www/frontend/vendor/laravel/framework/src/Illuminate/Support/helpers.php on line 182  

我们在git上有供应商文件夹,因为没有它不是我们的选择。

我猜问题是不同的php版本。有没有办法手动设置php版本,因此composer获得了正确的依赖项?

2 个答案:

答案 0 :(得分:1)

你可以在require部分

中的composer.json文件中设置php版本
"require": {
"php": ">=5.3.0",
},

答案 1 :(得分:0)

问题可能是这样的:

用户签入了项目,包括供应商文件夹。

后来的供应商以某种方式被添加到.gitignore

没有人注意到新的文件没有被添加到回购中,魔法确保一切仍然有效:D