googleapis/google-cloud-php

google/cloud-recaptcha-enterprise PHP library v1.17.0: is it possible to downgrade the required minimal PHP version from 8.0 to 7.4?

LinaQiu opened this issue · 3 comments

Is your feature request related to a problem? Please describe.
This is Lina Qiu from reCAPTCHA Enterprise team. I am writing to consult about the minimal required PHP version for using the latest reCAPTCHA Enterprise PHP library.

We are building a reCAPTCHA WordPress plugin (written in PHP) for helping users protect their login-related requests. We need to decode the reCAPTCHA token (through our CreateAssessment API in the google/cloud-recaptcha-enterprise PHP library) to get the verdicts for making decisions.

We wanted to use the google/cloud-recaptcha-enterprise PHP library for this purpose. However, we couldn't use the latest library (v1.17.0) that has the most up to date features (e.g., AssessmentEnvironment) we need in the API, because it requires a minimal PHP version of 8.0. The WordPress plugin we are building plans to support PHP version 7.4 and above, because there is still a significant percentage of WordPress plugins on PHP v7.4 (32.8%): https://en-ca.wordpress.org/about/stats/.

Can we make the google/cloud-recaptcha-enterprise PHP library support PHP v7.4?

Describe the solution you'd like

  • Regenerate 1.17.0 with the last PHP 7.4-compatible version of the gapic generator.
  • Release it as google/cloud-recaptcha-enterprise:dev-1.17.0-php74 to make it an "official" version of google/cloud-recaptcha-enterprise that supports PHP v7.4 with the latest features we need.

Note this is an one-off solution that will be available to the public (especially WordPress plugin devs who still need to support PHP v7.4) to use, with the latest features from reCAPTHCHA Enterprise (e.g., AssessmentEnvironment.

As we've discussed, the best solution would be to regenerate the 1.17.0 version of google/cloud-recaptcha-enterprise with the last PHP 7.4-compatible version of the GAPIC generator. We can release this as 1.17.x-php74, which will then be installable by composer as

composer require "google/cloud-recaptcha-enterprise:dev-1.17.x-php74 as 1.17.0"

This will be a one-off, but we could submit bugfixes to it, and potentially tag it. I'd like to look into possible tags which composer will only download if explicitly set, such as 1.17.x-php74 or 1.17.0-dev.

Please test the PR above with the following command:

composer require google/cloud-recaptcha-enterprise:dev-1.17.x-php74

Please comment here or on that PR that this meets your requirements, and I can merge it and tag a new version 1.17.0-php74. This will then be installable by running the command above, but with 1.17.0-php74 for the version instead of dev-1.17.x-php74