Google Ads API is returning to beta status. Please read our blog post for more details.

Protobuf implementations

There are two implementations that are available for PHP:

  1. C: the Protobuf PHP extension for better performance
  2. PHP: the google/protobuf PHP package to get started easily

We recommend to use the C implementation but some users might need the PHP implementation instead because of security or technical constraint for examples.

The PHP implementation is automatically installed like any other googleapis/gax-php dependencies via Composer but it is used at runtime only if the C implementation is not installed and configured.

Use the C implementation

Install and configure the Protobuf PHP extension:

  1. Run command sudo pecl install protobuf.
  2. Add a line to the php.ini file.

Use the PHP implementation

Make sure the C implementation is disabled and all the dependencies of the googleapis/gax-php library are installed:

  1. Comment out the line of the php.ini file if any.
  2. Run command composer install in the directory that contains the composer.json file of the project being worked on (google-ads-php itself or any project that requires it as a dependence).

Determine which implementation is being used

Run php -i | grep protobuf:

  • If not empty, you're using the C implementation
  • Otherwise, you're not using the C implementation and the Google Ads API PHP library will rely on the PHP implementation (if installed correctly via Composer)

Send feedback about...

Google Ads API Beta
Google Ads API Beta
Need help? Visit our support page.