Phpinsights: [Laravel] Support lower Laravel version then 5.7

Created on 15 May 2019  路  7Comments  路  Source: nunomaduro/phpinsights

Minimum Laravel version is currently 5.7 due to the requirement of symfony/console 4.2

Older Laravel versions use much older version (example: L5.1 LTS required 2.7.*)

This may not be the only dependency issue, but is as far as I got when attempting to install the package

enhancement

Most helpful comment

You could do it these ways.

Option 1

Create a file path-to-your-project/phpinsight.sh

#!/bin/sh
composer global require nunomaduro/phpinsights
cp ~/.composer/vendor/nunomaduro/phpinsights/stubs/laravel.php phpinsights.php
php -d memory_limit=-1 ~/.composer/vendor/bin/phpinsights --config-path=phpinsights.php

Option 2

Create a file path-to-your-project/phpinsight.sh

#!/bin/sh
rm -rf ../phpinsights
(
    mkdir -p ../phpinsights
    cd ../phpinsights
    touch composer.json
    echo '{}' > composer.json
    composer require nunomaduro/phpinsights
)
php -d memory_limit=-1 ../phpinsights/vendor/bin/phpinsights --config-path=../phpinsights/vendor/nunomaduro/phpinsights/stubs/laravel.php

All 7 comments

I have this problem too, tried to install it in a 5.5 LTS app

I encountered this issue as well in Laravel 5.5.

What if you install it globally instead of within your project itself and then use the binary to run on your project?

You could do it these ways.

Option 1

Create a file path-to-your-project/phpinsight.sh

#!/bin/sh
composer global require nunomaduro/phpinsights
cp ~/.composer/vendor/nunomaduro/phpinsights/stubs/laravel.php phpinsights.php
php -d memory_limit=-1 ~/.composer/vendor/bin/phpinsights --config-path=phpinsights.php

Option 2

Create a file path-to-your-project/phpinsight.sh

#!/bin/sh
rm -rf ../phpinsights
(
    mkdir -p ../phpinsights
    cd ../phpinsights
    touch composer.json
    echo '{}' > composer.json
    composer require nunomaduro/phpinsights
)
php -d memory_limit=-1 ../phpinsights/vendor/bin/phpinsights --config-path=../phpinsights/vendor/nunomaduro/phpinsights/stubs/laravel.php

Refer to the official documentation on the solution for this:

https://phpinsights.com/get-started.html#avoid-composer-conflicts

Personally, I also add the: --dev, flag when requiring the package itself.

It was requested for me to post this as an issue, I believe Nuno may work to make this more compatible, but the workarounds might be the only solution. I cant comment either way. Ive been using a variation of above script and works fine for me.

There are two options to avoid this issue here: https://phpinsights.com.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sciracioglu picture sciracioglu  路  3Comments

michaelnguyen547 picture michaelnguyen547  路  6Comments

Gummibeer picture Gummibeer  路  4Comments

dmitryuk picture dmitryuk  路  5Comments

brunocfalcao picture brunocfalcao  路  5Comments