NOTE: This repository is part of Google Cloud PHP. Any
support requests, bug reports, or development contributions should be directed to
that project.
A feature of Google Cloud Platform that lets you inspect the state of an application, at any code location, without
stopping or slowing down the running app. Stackdriver Debugger makes it easier to view the application state without
adding logging statements.
Installation
Install the PHP extension from PECL.
$ pecl install stackdriver_debugger-alpha
On Windows, you can download pre-built .dll files from PECL.
You may also need to enable the extension in your php.ini file:
# on Unix
extension=stackdriver_debugger.so
# on Windows
extension=php_stackdriver_debugger.dll
Install with composer or add to your composer.json.
Include and start the debugger Agent as the first action in your
application:
$agent = new Google\Cloud\Debugger\Agent();
If this file is not in your source root, you will need to provide the path to
your application's source root as an optional parameter:
$agent = new Google\Cloud\Debugger\Agent([
'sourceRoot' => '/path/to/source/root'
]);
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.
Authentication
Please see our Authentication guide for more information
on authenticating your client. Once authenticated, you'll be ready to start making requests.
Sample
use Google\Cloud\Debugger\DebuggerClient;
$debugger = new DebuggerClient();
$debuggee = $debugger->debugee();
$debuggee->register();
Configuration
Snapshots
Debugger snapshots allow you to capture and inspect the call stack and local
variables in your application without stopping or slowing it down. In general,
you will set breakpoints via the Stackdriver Debugger UI in the
Cloud Platform Console.
Debugger logpoints allow you to inject logging into running services without
restarting or interfering with the normal function of the service. This can be
useful for debugging production issues without having to add log statements and
redeploy.
By default, we will send all log messages to Stackdriver Logging, but you can
customize this by providing any PSR-3 compatible logger. For example, to use
monolog:
$agent = new Google\Cloud\Debugger\Agent([
'logger' => new Monolog\Logger('name')
]);
Please see our Debugging guide
for more information about the debugging tools.
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.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-28 UTC."],[],[],null,["Version latestkeyboard_arrow_down\n\n- [1.9.5 (latest)](/php/docs/reference/cloud-debugger/latest)\n- [1.9.4](/php/docs/reference/cloud-debugger/1.9.4)\n- [1.8.8](/php/docs/reference/cloud-debugger/1.8.8)\n- [1.7.0](/php/docs/reference/cloud-debugger/1.7.0)\n- [1.6.4](/php/docs/reference/cloud-debugger/1.6.4)\n- [1.5.1](/php/docs/reference/cloud-debugger/1.5.1)\n- [1.4.16](/php/docs/reference/cloud-debugger/1.4.16) \n\nGoogle PHP Stackdriver Debugger\n===============================\n\n\u003e Idiomatic PHP client for [Stackdriver Debugger](https://cloud.google.com/debugger/).\n\n[](https://packagist.org/packages/google/cloud-debugger) [](https://packagist.org/packages/google/cloud-debugger)\n\n**IMPORTANT** : This library has been deprecated. See [Cloud Debugger Deprecation](https://cloud.google.com/stackdriver/docs/deprecations/debugger-deprecation)\n\n**NOTE:** This repository is part of [Google Cloud PHP](https://github.com/googleapis/google-cloud-php). Any\nsupport requests, bug reports, or development contributions should be directed to\nthat project.\n\nA feature of Google Cloud Platform that lets you inspect the state of an application, at any code location, without\nstopping or slowing down the running app. Stackdriver Debugger makes it easier to view the application state without\nadding logging statements.\n\n### Installation\n\n1. Install the PHP extension from PECL.\n\n $ pecl install stackdriver_debugger-alpha\n\n On Windows, you can download pre-built .dll files [from PECL](https://pecl.php.net/package/stackdriver_debugger).\n\n You may also need to enable the extension in your `php.ini` file: \n\n # on Unix\n extension=stackdriver_debugger.so\n\n # on Windows\n extension=php_stackdriver_debugger.dll\n\n2. Install with `composer` or add to your `composer.json`.\n\n $ composer require google/cloud-debugger\n\n3. Run the batch daemon script in the background.\n\n On Unix-based systems that have\n [semaphore extensions](http://php.net/manual/en/book.sem.php) installed, run the\n [BatchDaemon](https://github.com/googleapis/google-cloud-php/blob/main/Core/src/Batch/BatchDaemon.php): \n\n $ vendor/bin/google-cloud-batch daemon\n\n On Windows or systems that do not have\n [semaphore extensions](http://php.net/manual/en/book.sem.php) installed, run the Debugger\n [Daemon](https://cloud.google.com/php/docs/reference/debugger/latest/Daemon): \n\n $ vendor/bin/google-cloud-debugger -s \u003cSOURCE_ROOT\u003e\n\n The `SOURCE_ROOT` is the base location of your deployed application.\n\n Alternatively, you can provide a configuration script: \n\n $ vendor/bin/google-cloud-debugger -c \u003cCONFIG_FILE\u003e\n\n4. Include and start the debugger `Agent` as the first action in your\n application:\n\n $agent = new Google\\Cloud\\Debugger\\Agent();\n\n If this file is not in your source root, you will need to provide the path to\n your application's source root as an optional parameter: \n\n $agent = new Google\\Cloud\\Debugger\\Agent([\n 'sourceRoot' =\u003e '/path/to/source/root'\n ]);\n\nThis 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)\nplease see our [gRPC installation guide](https://cloud.google.com/php/grpc).\n\n### Authentication\n\nPlease see our [Authentication guide](https://github.com/googleapis/google-cloud-php/blob/main/AUTHENTICATION.md) for more information\non authenticating your client. Once authenticated, you'll be ready to start making requests.\n\n### Sample\n\n use Google\\Cloud\\Debugger\\DebuggerClient;\n\n $debugger = new DebuggerClient();\n $debuggee = $debugger-\u003edebugee();\n $debuggee-\u003eregister();\n\n### Configuration\n\n#### Snapshots\n\nDebugger snapshots allow you to capture and inspect the call stack and local\nvariables in your application without stopping or slowing it down. In general,\nyou will set breakpoints via the Stackdriver Debugger UI in the\n[Cloud Platform Console](https://console.cloud.google.com/debug).\n\nSee [Using Debug Snapshots](https://cloud.google.com/debugger/docs/debugging) for more information on\nsnapshots.\n\n#### Logpoints\n\nDebugger logpoints allow you to inject logging into running services without\nrestarting or interfering with the normal function of the service. This can be\nuseful for debugging production issues without having to add log statements and\nredeploy.\n\nBy default, we will send all log messages to Stackdriver Logging, but you can\ncustomize this by providing any PSR-3 compatible logger. For example, to use\n`monolog`: \n\n $agent = new Google\\Cloud\\Debugger\\Agent([\n 'logger' =\u003e new Monolog\\Logger('name')\n ]);\n\nSee [Using Debug Logpoints](https://cloud.google.com/debugger/docs/logpoints) for more information on\nlogpoints.\n\n### Debugging\n\nPlease see our [Debugging guide](https://github.com/googleapis/google-cloud-php/blob/main/DEBUG.md)\nfor more information about the debugging tools.\n\n### Version\n\nThis component is considered GA (generally available). As such, it will not introduce backwards-incompatible changes in\nany minor or patch releases. We will address issues and requests with the highest priority.\n\n### Next Steps\n\n1. Understand the [official documentation](https://cloud.google.com/debugger/docs/).\n2. Take a look at [in-depth usage samples](https://github.com/GoogleCloudPlatform/php-docs-samples/tree/master/debugger)."]]