Google PHP Stackdriver Debugger
Idiomatic PHP client forStackdriver Debugger.
IMPORTANT: This library has been deprecated. SeeCloud Debugger Deprecation
NOTE: This repository is part ofGoogle Cloud PHP. Anysupport requests, bug reports, or development contributions should be directed tothat project.
A feature of Google Cloud Platform that lets you inspect the state of an application, at any code location, withoutstopping or slowing down the running app. Stackdriver Debugger makes it easier to view the application state withoutadding logging statements.
Installation
Install the PHP extension from PECL.
$ pecl install stackdriver_debugger-alphaOn Windows, you can download pre-built .dll filesfrom PECL.
You may also need to enable the extension in your
php.inifile:# on Unixextension=stackdriver_debugger.so# on Windowsextension=php_stackdriver_debugger.dllInstall with
composeror add to yourcomposer.json.$ composer require google/cloud-debuggerRun the batch daemon script in the background.
On Unix-based systems that havesemaphore extensions installed, run theBatchDaemon:
$ vendor/bin/google-cloud-batch daemonOn Windows or systems that do not havesemaphore extensions installed, run the DebuggerDaemon:
$ vendor/bin/google-cloud-debugger -s <SOURCE_ROOT>The
SOURCE_ROOTis the base location of your deployed application.Alternatively, you can provide a configuration script:
$ vendor/bin/google-cloud-debugger -c <CONFIG_FILE>Include and start the debugger
Agentas the first action in yourapplication:$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 ourgRPC installation guide.
Authentication
Please see ourAuthentication guide for more informationon 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 localvariables in your application without stopping or slowing it down. In general,you will set breakpoints via the Stackdriver Debugger UI in theCloud Platform Console.
SeeUsing Debug Snapshots for more information onsnapshots.
Logpoints
Debugger logpoints allow you to inject logging into running services withoutrestarting or interfering with the normal function of the service. This can beuseful for debugging production issues without having to add log statements andredeploy.
By default, we will send all log messages to Stackdriver Logging, but you cancustomize this by providing any PSR-3 compatible logger. For example, to usemonolog:
$agent = new Google\Cloud\Debugger\Agent([ 'logger' => new Monolog\Logger('name')]);SeeUsing Debug Logpoints for more information onlogpoints.
Debugging
Please see ourDebugging guidefor more information about the debugging tools.
Version
This component is considered GA (generally available). As such, it will not introduce backwards-incompatible changes inany minor or patch releases. We will address issues and requests with the highest priority.
Next Steps
- Understand theofficial documentation.
- Take a look atin-depth usage samples.
Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-10-30 UTC.