AI-generated Key Takeaways
-
The API supports two transport types, gRPC and REST, with the client library automatically selecting the optimal one.
-
gRPC is the preferred transport, requiring a PHP extension and based on HTTP/2, while REST is an alternative based on HTTP/1.1 that needs no extension.
-
You can manually specify the transport type in the
google_ads_php.ini
file or programmatically using theGoogleAdsClientBuilder
. -
The gRPC version is typically specified in
google/gax
'scomposer.json
, though the PHP library may sometimes directly specify the protobuf version for performance or compatibility.
There are two types of transport that can be used when sending requests to the API. Our client library selects the optimal one from the following:
- Preferred: gRPC. It requires the installation of the gRPC PHP extension and it is based on HTTP/2.
- Alternative used when gRPC is not available: REST. It does not require the installation of any PHP extension and it is based on HTTP/1.1.
If you prefer to specify the transport type yourself instead of relying on
the default rules described above, you can set the transport
property in the
CONNECTION
section of your
google_ads_php.ini
file:
[CONNECTION]
; Optional transport settings.
; By default, "grpc" is used if available otherwise "rest".
transport = "grpc"
Alternatively, you can configure the transport setting programmatically like every other ones:
$googleAdsClient = (new GoogleAdsClientBuilder())
...
->withTransport('grpc')
->build();