3
votes

I'm trying to install the MakerBundle for Symfony (3.4) as stated in the documentation.

The command I run is:

composer require symfony/maker-bundle --dev

But I got this:

[InvalidArgumentException]
Package symfony/maker-bundle at version has a PHP requirement incompatible with your PHP version (5.6)

Checking my php version ( php -v ) gives :

PHP 7.0.27-0+deb9u1 (cli) (built: Jan 5 2018 13:51:52) ( NTS ) Copyright (c) 1997-2017 The PHP Group Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies with Zend OPcache v7.0.27-0+deb9u1, Copyright (c) 1999-2017, by Zend Technologies with Xdebug v2.5.0, Copyright (c) 2002-2016, by Derick Rethans

Am I missing something?

2
Maybe PHP cli version is good but not the PHP server versionSmaïne
This is what php -i brings ( first few lines ... ) phpinfo() PHP Version => 7.0.27-0+deb9u1 System => Linux myServer 4.9.0-6-amd64 #1 SMP Debian 4.9.82-1+deb9u3 (2018-03-02) x86_64 Build Date => Jan 5 2018 13:51:52 Server API => Command Line Interface Virtual Directory Support => disabled Configuration File (php.ini) Path => /etc/php/7.0/cli Loaded Configuration File => /etc/php/7.0/cli/php.ini Scan this dir for additional .ini files => /etc/php/7.0/cli/conf.d Additional .ini files parsed => /etc/php/7.0/cli/conf.d/10-mysqlnd.ini,user1077915
It is possibile that you have missed to install flex?sensorario
Fix is missing. But I got the same error. Reading deeper the Symfony documentation, I found this symfony.com/doc/3.4/setup/flex.html. where it is explained how to install flex ( it is needed to do some adjustments ). Thanks.user1077915

2 Answers

1
votes

You need to change the php version inside composer.json file. "config": { "platform": { "php": "7.2" }, "sort-packages": true },

Find the above code in composer.json file in you symfony project root directory.

There will be 5.6 in your case just change it to 7.2

Then again run your command it'll work perfectly.

0
votes

In order to install maker-bundle, it is required to use the new project structure.
There are two options :

  • create the project with the new template : composer create-project symfony/skeleton my-project

  • follow the instructions as stated in https://symfony.com/doc/3.4/setup/flex.html to convert the project's structure and then be able to install flex and maker.