How can I install google/protobuf via composer?

491 Views Asked by At

I am trying to install Protobuf PHP extension in my php project as per the documentation given in https://github.com/googleads/google-ads-php requirements section in readme file.

It gives me following error when I try to install the package via composer require google/protobuf.

Your requirements could not be resolved to an installable set of packages.

Problem 1 - Root composer.json requires PHP extension ext-protobuf * but it is missing from your system. Install or enable PHP's protobuf extension.

To enable extensions, verify that they are enabled in your .ini files: - D:\xampp\php\php.ini You can also run php --ini in a terminal to see which files are used by PHP in CLI mode. Alternatively, you can run Composer with --ignore-platform-req=ext-protobuf to temporarily ignore these required extensions.

Can anyone guide me to installation process of this extension ?

1

There are 1 best solutions below

0
yivi On

Either:

  • remove ext-protobuf from the require part of your composer.json

or

  • add --ignore-platform-req=ext-protobuf to the require command when installing (as shown in the error message you are actually quoting).

Since you are installing a PHP implementation for protobuf, it makes sense removing the extension as a requirement.