简体   繁体   English

作曲家:PHP 5.6项目中的PHP 7依赖性

[英]Composer: PHP 7 dependency in PHP 5.6 project

I have a PHP 5.6 Nette project (but I think this question includes all php projects with composer) and I would like to add dependency written in PHP 7. Also, PHP for this project is set to 5.6. 我有一个PHP 5.6 Nette项目(但我认为这个问题包括所有带有作曲家的php项目),我想添加用PHP 7编写的依赖项。此外,该项目的PHP设置为5.6。

Can this work? 能行吗?

Another side question. 另一个问题。 If I have to give PHP 7 to the project, shouldn't I set PHP to 7 for this project despite the fact, that the project itself is built in PHP 5.6? 如果必须为该项目提供PHP 7,尽管该项目本身是在PHP 5.6中构建的,但我是否应该将该项目的PHP设置为7?

Thank you for your answers. 谢谢您的回答。

If you bring in PHP7 based deps, youll need to run the whole project on PHP7. 如果引入基于PHP7的部门,则需要在PHP7上运行整个项目。

This will likely work fine, but you need to watch out for the compatibility issues between 7 and 5. 这可能会很好地工作,但是您需要注意7到5之间的兼容性问题。

There are more than you think, particularly around dereferencing. 还有比您想象的更多的东西,尤其是在取消引用方面。

Check here for the migration document. 在此处查看迁移文档。

Some dependencies were written in PHP 7 with new features will not work with PHP 5.6. 一些依赖关系是用PHP 7编写的,具有新功能,这些依赖关系不适用于PHP 5.6。

http://php.net/manual/en/migration70.new-features.php http://php.net/manual/en/migration70.new-features.php

But when set our project to PHP 7, your project should work. 但是,当将我们的项目设置为PHP 7时,您的项目应该可以工作。 But, as @DevDonkey mentioned, we need to check the compatibility issues between 7 and 5. 但是,正如@DevDonkey所述,我们需要检查7和5之间的兼容性问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM