ext-json is missing in composer.json. What is this?

Luís Nóbrega
2 min readAug 18, 2018
Composer logo

PHPStorm 2018.2 EAP build (182.3458.35) brought better Composer support.

Because of this, in my code, when I used json_encode function, a warning with the following message appeared:

ext-json is missing in composer.json

I didn’t know what this warning was.

After checking PHPStorm blog I understand what was his meaning. I was missing the following line in composer.json file:

“ext-json”: “*”

In the require section.

This makes total sense. This way you can list all the PHP extensions that your project requires.

Meaning you can prevent any problems caused by missing installed extensions.

Check the Composer website explanation:

It is important to list PHP extensions your project requires. Not all PHP installations are created equal: some may miss extensions you may consider as standard (such as ext-mysqliwhich is not installed by default in Fedora/CentOS minimal installation systems). Failure to list required PHP extensions may lead to a bad user experience: Composer will install your package without any errors but it will then fail at run-time. The show — platform command lists all PHP extensions available on your system. You may use…

--

--

Luís Nóbrega

Web Developer at 25friday. Likes to travel, write and being a father.