There are two types of transport that can be used when sending requests to the
API. The PHP client library automatically selects the optimal transport based on
your environment:

- **Preferred (`grpc`)** : [gRPC](https://grpc.io/about/). It requires installing the [gRPC PHP extension](https://grpc.io/docs/languages/php/quickstart/) and is based on HTTP/2.
- **Fallback (`rest`)** : [REST](https://en.wikipedia.org/wiki/Representational_state_transfer). Used automatically when the gRPC extension is not available. It does not require installing any additional PHP extensions and is based on HTTP/1.1.

## Configure transport

If you prefer to explicitly specify the transport type (`grpc` or `rest`)
instead of relying on the default automatic selection rules described in the
preceding section, you can configure the `transport` setting in your
`google_ads_php.ini` file or programmatically.

### Configure in google_ads_php.ini

Set the `transport` property in the `CONNECTION` section of your
[`google_ads_php.ini`](https://github.com/googleads/google-ads-php/blob/HEAD/examples/Authentication/google_ads_php.ini) file:

    [CONNECTION]
    ; Optional transport settings.
    ; By default, "grpc" is used if available; otherwise, "rest" is used.
    transport = "grpc"

### Configure programmatically

Alternatively, you can configure the transport setting programmatically when
constructing the client:

    $googleAdsClient = (new GoogleAdsClientBuilder())
        // ...
        ->withTransport('grpc')
        ->build();

> [!IMPORTANT]
> **Key Point:** Typically, the `grpc` package version that this PHP library relies on is transitively specified in the [`composer.json` file of
> `google/gax`](https://github.com/googleapis/gax-php/blob/master/composer.json), which is one of the core dependencies. In some cases, the `google/protobuf` or `grpc/grpc` dependency version may also be specified directly in the PHP library's [`composer.json`](https://github.com/googleads/google-ads-php/blob/HEAD/composer.json) for performance or compatibility.