15

I have trouble installing devisephp for laravel. I am working on the latest version of homestead with php7. when i do composer update i get the following error.

Problem 1
    - Installation request for devisephp/cms 1.4.* -> satisfiable by devisephp/cms[1.4.0].
    - devisephp/cms 1.4.0 requires ext-imagick * -> the requested PHP extension imagick is missing from your system.

After having this message i installed imagick on my homestead environment added the extension to php.ini in cli and fpm and checked in homestead if imagick is working with a test file. Everything was working perfectly but on running composer update i still get the same error message from above. Does anyone have a clue what the problem can be.

The stange thing is that is kan git clone devisephp its bootstrap version completely working including image handling but when i add another package to laravel i again get the above message.

maesk
  • 233
  • 1
  • 4
  • 11

5 Answers5

25

if you really can't install or don't want that extension to be validated you may skip it by supplying the

--ignore-platform-reqs

flag to your composer command

Roman86
  • 1,990
  • 23
  • 22
  • 1
    Wow, I wish I had found this a long time ago. Would have saved me a lot of pain -- I sometimes need to composer-install packages just to have my local PHPStorm play ball, but I don't need them to actually work locally. I just need the code completion / intellisense benefits. – TKoL Mar 19 '20 at 15:22
  • 1
    This option helped me while struggling to find a solution for extension issue. Many thanks. – Rajitha Bandara Jul 28 '20 at 10:48
  • One can also use the `config.platform` setting to fake the dependency: https://stackoverflow.com/a/67919544/814031 – marcus Jul 24 '21 at 20:32
16

Please follow these steps

  • sudo apt-get install php-imagick
  • php -m | grep imagick // this should print 'imagick' it means installed correctly
  • sudo service apache2 restart //(if needed)
Isha
  • 391
  • 3
  • 4
1

Try adding:

"ext-imagick": "*",

to your require block in your composer.json like so:

"license": "MIT",
"require": {
    "ext-imagick": "*",
    ....
}

and run composer update

Tofunmi
  • 121
  • 1
  • 3
0

With the config.platform key in composer.js you can fake dependencies like php versions or extensions (you can't use an asterisk for the extension version, though!) https://getcomposer.org/doc/06-config.md#platform

As a bonus, you can polyfill ext-imagick with this library: https://github.com/calcinai/php-imagick. it's not complete and relies on the command line ImageMagick. So far it works for me.

{
    "require": {
        "calcinai/php-imagick": "dev-master"
    },
    "config": {
      "platform":{
        "ext-imagick": "3.4.4"
        }
    }
}
marcus
  • 699
  • 11
  • 33
0

In case you are using Mac, here are the steps:

  1. Install Image Magick dependency.

    brew install pkg-config imagemagick

  2. Compile Imagick PHP extension with pecl

    pecl install imagick

  3. Verify the installation.

    php -m | grep -i magic

    You will see imagick.

Player1
  • 2,878
  • 2
  • 26
  • 38