James Craig
James Craig

Reputation: 6864

Is Laravel 5.1 Compatible with PHP 7

According to the installation section on the Laravel website, 5.1 is compatible with PHP >= 5.5.9.

Looking through the incompatibilities I can't see anything that immediately flags warning signs.

Has anyone run into issues running PHP 7 with Laravel 5.1?

Edit: Set Kyar Wa Lar linked a useful resource to PHP 7 and Laravel.

Upvotes: 16

Views: 25011

Answers (3)

Karthik SWOT
Karthik SWOT

Reputation: 1217

For better experience with PHP 7.3, you may simply upgrade it to Laravel 5.2. It works well with PHP 7.3 environment.

Upvotes: 0

monque
monque

Reputation: 133

For Laravel 5.1.43, with updated vendor, is compatible with PHP 7.

and you can make sure through these methods by your self for any version of Laravel.

1. All unit test passed in 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

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.

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

3. Analysis using 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.

Upvotes: 7

davios
davios

Reputation: 136

No issues on my local VM installed from Laravel Homestead Box. Everything works really fine.

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

Upvotes: 11

Related Questions