PHPackages                             google/cloud-trace - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Logging &amp; Monitoring](/categories/logging)
4. /
5. google/cloud-trace

ActiveLibrary[Logging &amp; Monitoring](/categories/logging)

google/cloud-trace
==================

Stackdriver Trace Client for PHP

v1.9.5(3mo ago)231.3M↑13.4%47Apache-2.0PHPPHP ^8.1CI passing

Since May 25Pushed 2mo ago53 watchersCompare

[ Source](https://github.com/googleapis/google-cloud-php-trace)[ Packagist](https://packagist.org/packages/google/cloud-trace)[ RSS](/packages/google-cloud-trace/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (9)Versions (100)Used By (7)

Stackdriver Trace for PHP
=========================

[](#stackdriver-trace-for-php)

> Idiomatic PHP client for [Stackdriver Trace](https://cloud.google.com/trace/).

[![Latest Stable Version](https://camo.githubusercontent.com/e8e5937af07bbefdccd706277957c9cfcce0d0bd6d111b6a5145e9a4db035eca/68747470733a2f2f706f7365722e707567782e6f72672f676f6f676c652f636c6f75642d74726163652f762f737461626c65)](https://packagist.org/packages/google/cloud-trace) [![Packagist](https://camo.githubusercontent.com/9c8aa6000195e284ea3cf2afa2efdb654c0b46831d062ec97b340edf55afe4ed/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646d2f676f6f676c652f636c6f75642d74726163652e737667)](https://packagist.org/packages/google/cloud-trace)

- [API documentation](https://cloud.google.com/php/docs/reference/cloud-trace/latest)

**NOTE:** This repository is part of [Google Cloud PHP](https://cloud.google.com/php/docs/reference). Any support requests, bug reports, or development contributions should be directed to that project.

A distributed tracing system for Google Cloud Platform that collects latency data from App Engine applications and displays it in near real time in the Google Cloud Platform Console.

### Installation

[](#installation)

To begin, install the preferred dependency manager for PHP, [Composer](https://getcomposer.org/).

Now install this component:

```
$ composer require google/cloud-trace
```

This component supports both REST over HTTP/1.1 and gRPC. In order to take advantage of the benefits offered by gRPC (such as streaming methods) please see our [gRPC installation guide](https://cloud.google.com/php/grpc).

### Authentication

[](#authentication)

Please see our [Authentication guide](https://github.com/googleapis/google-cloud-php/blob/main/AUTHENTICATION.md)for more information on authenticating your client. Once authenticated, you'll be ready to start making requests.

### Sample

[](#sample)

```
use Google\ApiCore\ApiException;
use Google\Cloud\Trace\V2\Client\TraceServiceClient;
use Google\Cloud\Trace\V2\Span;
use Google\Cloud\Trace\V2\TruncatableString;
use Google\Protobuf\Timestamp;

// Create a client.
$traceServiceClient = new TraceServiceClient();

// Prepare the request message.
$displayName = new TruncatableString();
$startTime = new Timestamp();
$endTime = new Timestamp();
$request = (new Span())
    ->setName($name)
    ->setSpanId($spanId)
    ->setDisplayName($displayName)
    ->setStartTime($startTime)
    ->setEndTime($endTime);

// Call the API and handle any network failures.
try {
    /** @var Span $response */
    $response = $traceServiceClient->createSpan($request);
    printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
    printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
```

See the [OpenCensus documentation](https://github.com/census-instrumentation/opencensus-php) for more configuration options and features.

### Debugging

[](#debugging)

Please see our [Debugging guide](https://github.com/googleapis/google-cloud-php/blob/main/DEBUG.md)for more information about the debugging tools.

### Version

[](#version)

This component is considered GA (generally available). As such, it will not introduce backwards-incompatible changes in any minor or patch releases. We will address issues and requests with the highest priority.

### Next Steps

[](#next-steps)

1. Understand the [official documentation](https://cloud.google.com/trace/docs/).
2. Take a look at [in-depth usage samples](https://github.com/GoogleCloudPlatform/php-docs-samples/tree/master/trace/).

###  Health Score

67

—

FairBetter than 100% of packages

Maintenance83

Actively maintained with recent releases

Popularity48

Moderate usage in the ecosystem

Community35

Small or concentrated contributor base

Maturity88

Battle-tested with a long release history

 Bus Factor3

3 contributors hold 50%+ of commits

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~32 days

Recently: every ~40 days

Total

99

Last Release

62d ago

Major Versions

v0.18.0 → v1.0.02020-04-07

v1.9.5 → v2.0.0-RC12026-03-17

PHP version history (3 changes)v1.5.2PHP &gt;=7.4

v1.8.3PHP ^8.0

v1.8.10PHP ^8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/a8713415b20b4be4cec8f8b22741e3cd05f76eee9e38de1de5bf32727349b7c5?d=identicon)[bshaffer](/maintainers/bshaffer)

![](https://www.gravatar.com/avatar/3901206952845568d7557a60855b097f6d1bafaa7a24020cfcf5bb8de74f9d28?d=identicon)[google-cloud](/maintainers/google-cloud)

---

Top Contributors

[![release-please[bot]](https://avatars.githubusercontent.com/in/40688?v=4)](https://github.com/release-please[bot] "release-please[bot] (46 commits)")[![jdpedrie](https://avatars.githubusercontent.com/u/89034?v=4)](https://github.com/jdpedrie "jdpedrie (36 commits)")[![yoshi-automation](https://avatars.githubusercontent.com/u/44816363?v=4)](https://github.com/yoshi-automation "yoshi-automation (32 commits)")[![bshaffer](https://avatars.githubusercontent.com/u/103941?v=4)](https://github.com/bshaffer "bshaffer (31 commits)")[![gcf-owl-bot[bot]](https://avatars.githubusercontent.com/in/99011?v=4)](https://github.com/gcf-owl-bot[bot] "gcf-owl-bot[bot] (22 commits)")[![dwsupplee](https://avatars.githubusercontent.com/u/2079879?v=4)](https://github.com/dwsupplee "dwsupplee (20 commits)")[![michaelbausor](https://avatars.githubusercontent.com/u/14846209?v=4)](https://github.com/michaelbausor "michaelbausor (12 commits)")[![jeromegamez](https://avatars.githubusercontent.com/u/67554?v=4)](https://github.com/jeromegamez "jeromegamez (3 commits)")[![vishwarajanand](https://avatars.githubusercontent.com/u/7369612?v=4)](https://github.com/vishwarajanand "vishwarajanand (3 commits)")[![chingor13](https://avatars.githubusercontent.com/u/32483?v=4)](https://github.com/chingor13 "chingor13 (3 commits)")[![saranshdhingra](https://avatars.githubusercontent.com/u/1038319?v=4)](https://github.com/saranshdhingra "saranshdhingra (2 commits)")[![WeiranFang](https://avatars.githubusercontent.com/u/8175562?v=4)](https://github.com/WeiranFang "WeiranFang (2 commits)")[![dpebot](https://avatars.githubusercontent.com/u/19979279?v=4)](https://github.com/dpebot "dpebot (2 commits)")[![ajupazhamayil](https://avatars.githubusercontent.com/u/14087896?v=4)](https://github.com/ajupazhamayil "ajupazhamayil (1 commits)")[![GimmyHchs](https://avatars.githubusercontent.com/u/11835351?v=4)](https://github.com/GimmyHchs "GimmyHchs (1 commits)")[![Hectorhammett](https://avatars.githubusercontent.com/u/9062626?v=4)](https://github.com/Hectorhammett "Hectorhammett (1 commits)")[![renovate-bot](https://avatars.githubusercontent.com/u/25180681?v=4)](https://github.com/renovate-bot "renovate-bot (1 commits)")[![vam-google](https://avatars.githubusercontent.com/u/25311427?v=4)](https://github.com/vam-google "vam-google (1 commits)")[![danielgsims](https://avatars.githubusercontent.com/u/695933?v=4)](https://github.com/danielgsims "danielgsims (1 commits)")

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/google-cloud-trace/health.svg)

```
[![Health](https://phpackages.com/badges/google-cloud-trace/health.svg)](https://phpackages.com/packages/google-cloud-trace)
```

###  Alternatives

[google/cloud-logging

Stackdriver Logging Client for PHP

459.8M44](/packages/google-cloud-logging)[open-telemetry/sdk

SDK for OpenTelemetry PHP.

2322.9M248](/packages/open-telemetry-sdk)[google/cloud-error-reporting

Stackdriver Error Reporting Client for PHP

204.2M24](/packages/google-cloud-error-reporting)[vinelab/tracing-laravel

Distributed tracing for Laravel made easy

80118.7k1](/packages/vinelab-tracing-laravel)[scoutapp/scout-apm-php

Scout Application Performance Monitoring Agent - https://scoutapm.com

17877.0k5](/packages/scoutapp-scout-apm-php)[subzerobo/elastic-apm-php-agent

PHP Agent for Elastic APM With Intake API V2 Support + UDP Support

1119.1k](/packages/subzerobo-elastic-apm-php-agent)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
