Laravel 5.1是否与PHP 7兼容

时间:2015-12-16 09:24:18

标签: php laravel

根据Laravel网站上的installation section,5.1与PHP> = 5.5.9兼容。

仔细查看incompatibilities,我无法看到任何立即标记警示标志的内容。

有没有人遇到使用Laravel 5.1运行PHP 7的问题?

修改:Set Kyar Wa Lar将有用的资源与PHP 7 and Laravel相关联。

3 个答案:

答案 0 :(得分:11)

从Laravel Homestead Box安装的本地虚拟机没有问题。 一切都很好。

您可以在此处获得此框的所有设置信息以及PHP 7升级的特定部分:http://laravel.com/docs/5.1/homestead

答案 1 :(得分:7)

对于Laravel 5.1.43,更新后的vendor 与PHP 7兼容

你可以通过这些方法确保任何版本的Laravel。

<强> 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已经升级到PHP 7

  

Homestead可在任何Windows,Mac或Linux系统上运行,包括Nginx Web服务器,PHP 7.0,MySQL,Postgres,Redis,Memcached,Node以及开发令人惊叹的Laravel应用程序所需的所有其他好东西。< / p>

https://laravel.com/docs/5.1/homestead

第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
--------------------------------------------------------------------------------

手动检查后,这些点与PHP 7兼容。

答案 2 :(得分:0)

要获得PHP 7.3的更好体验,您可以简单地将其升级到Laravel 5.2。 它在PHP 7.3环境下工作良好。