Laravel 5.1 是否与 PHP 7 兼容
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/34308160/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Is Laravel 5.1 Compatible with PHP 7
提问by Enijar
According to the installation sectionon the Laravel website, 5.1 is compatible with PHP >= 5.5.9.
根据Laravel 网站上的安装部分,5.1 兼容 PHP >= 5.5.9。
Looking through the incompatibilitiesI can't see anything that immediately flags warning signs.
通过不兼容性,我看不到任何立即标记警告标志的东西。
Has anyone run into issues running PHP 7 with Laravel 5.1?
有没有人遇到过在 Laravel 5.1 上运行 PHP 7 的问题?
Edit: Set Kyar Wa Larlinked a useful resource to PHP 7 and Laravel.
编辑:Set Kyar Wa Lar将有用的资源链接到PHP 7 和 Laravel。
采纳答案by davios
No issues on my local VM installed from Laravel Homestead Box. Everything works really fine.
从 Laravel Homestead Box 安装的本地 VM 上没有问题。一切都很好。
You have all the setup information for this box here and a specific section for PHP 7 upgrade: http://laravel.com/docs/5.1/homestead
您在此处拥有此框的所有设置信息以及 PHP 7 升级的特定部分:http: //laravel.com/docs/5.1/homestead
回答by monque
For Laravel 5.1.43, with updated vendor
, is compatible with PHP 7.
对于Laravel 5.1.43,已更新vendor
,与 PHP 7 兼容。
and you can make sure through these methods by your self for any version of Laravel.
并且您可以通过这些方法自行确定任何版本的 Laravel。
1. All unit test passed in PHP 7.0.8
1.所有单元测试通过PHP 7.0.8
monque@e4300 ~/project/laravel_framework git:(db580b5) ? :( $ php phpunit-old.phar
PHPUnit 4.8.27 by Sebastian Bergmann and contributors.
Runtime: PHP 7.0.8
Configuration: /home/monque/project/laravel_framework/phpunit.xml
............................................................. 61 / 1748 ( 3%)
............................................................. 122 / 1748 ( 6%)
............................................................. 183 / 1748 ( 10%)
............................................................. 244 / 1748 ( 13%)
............................................................. 305 / 1748 ( 17%)
............................................................. 366 / 1748 ( 20%)
............................................................. 427 / 1748 ( 24%)
............................................................. 488 / 1748 ( 27%)
............................................................. 549 / 1748 ( 31%)
............................................................. 610 / 1748 ( 34%)
............................................................. 671 / 1748 ( 38%)
............................................................. 732 / 1748 ( 41%)
............................................................. 793 / 1748 ( 45%)
............................................................. 854 / 1748 ( 48%)
............................................................. 915 / 1748 ( 52%)
............................................................. 976 / 1748 ( 55%)
............................................................. 1037 / 1748 ( 59%)
............................................................. 1098 / 1748 ( 62%)
............................................................. 1159 / 1748 ( 66%)
............................................................. 1220 / 1748 ( 69%)
............................................................. 1281 / 1748 ( 73%)
............................................................. 1342 / 1748 ( 76%)
............................................................. 1403 / 1748 ( 80%)
............................................................. 1464 / 1748 ( 83%)
............................................................. 1525 / 1748 ( 87%)
............................................................. 1586 / 1748 ( 90%)
............................................................. 1647 / 1748 ( 94%)
............................................................. 1708 / 1748 ( 97%)
........................................
Time: 2.55 seconds, Memory: 64.00MB
OK (1748 tests, 3962 assertions)
2. Homestead for 5.1 is already upgrade to PHP 7
2. Homestead for 5.1 已经升级到 PHP 7
Homestead runs on any Windows, Mac, or Linux system, and includes the Nginx web server, PHP 7.0, MySQL, Postgres, Redis, Memcached, Node, and all of the other goodies you need to develop amazing Laravel applications.
Homestead 可在任何 Windows、Mac 或 Linux 系统上运行,包括 Nginx Web 服务器、PHP 7.0、MySQL、Postgres、Redis、Memcached、Node 以及开发出色 Laravel 应用程序所需的所有其他好东西。
https://laravel.com/docs/5.1/homestead
https://laravel.com/docs/5.1/homestead
3. Analysis using PHP-Migration
3.使用PHP-Migration进行分析
monque@e4300 ~/project/laravel_framework git:(db580b5) ? $ phpmig -sv70 src
File: src/Illuminate/Foundation/Bootstrap/HandleExceptions.php
--------------------------------------------------------------------------------
Found 1 spot(s), 0 identified
--------------------------------------------------------------------------------
35 | WARNING | | 7.0.0 | set_exception_handler() is no longer guaranteed to receive Exception objects
--------------------------------------------------------------------------------
File: src/Illuminate/Hashing/BcryptHasher.php
--------------------------------------------------------------------------------
Found 1 spot(s), 0 identified
--------------------------------------------------------------------------------
30 | DEPRECATED | | 7.0.0 | salt option for password_hash() is deprecated
--------------------------------------------------------------------------------
File: src/Illuminate/Support/Collection.php
--------------------------------------------------------------------------------
Found 1 spot(s), 0 identified
--------------------------------------------------------------------------------
157 | NOTICE | | 7.0.0 | Modulus operator will throw a exception if divisor is 0
--------------------------------------------------------------------------------
File: src/Illuminate/Encryption/McryptEncrypter.php
--------------------------------------------------------------------------------
Found 1 spot(s), 0 identified
--------------------------------------------------------------------------------
153 | NOTICE | | 7.0.0 | Modulus operator will throw a exception if divisor is 0
--------------------------------------------------------------------------------
These spots is compatible with PHP 7 after manually checking.
这些点在手动检查后与 PHP 7 兼容。
回答by Karthik SWOT
For better experience with PHP 7.3, you may simply upgrade it to Laravel 5.2. It works well with PHP 7.3 environment.
为了更好地使用 PHP 7.3,您可以简单地将其升级到 Laravel 5.2。它适用于 PHP 7.3 环境。