Download the PHP package chevere/xr without Composer
On this page you can find all versions of the php package chevere/xr. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package xr
xrDebug PHP client
Summary
PHP client library for xrDebug. This library provides a set of functions to dump variables, send raw messages, and interact with the inspector from your codebase.
Quick start
Install using Composer.
Use xr()
directly in your code to dump any variable. For example:
Configuring
This xrDebug PHP client uses the following default configuration.
Skip this section if running from the xrDebug binary and on the same machine.
Property | Type | Effect |
---|---|---|
isEnabled | bool | Controls sending messages to the server |
isHttps | bool | Controls use of https |
host | string | The host where xrDebug server is running |
port | int | The Port to connect to the host |
key | string | Private key (ed25519) for signed requests |
host
The hostname or IP. When running xrDebug on Docker usehost.docker.internal
.
File-based config
Configure the client by placing a xr.php
file in project's root directory. Need to define only the properties that override the default config.
We recommend adding xr.php
to your .gitignore
.
Here some examples of xr.php
:
-
Run with Docker at a
27980
port: - Run with sign verification:
Code-based config
Use function xrConfig()
to configure the xrDebug server connection directly in your logic. Need to define only the properties that override the default config.
Here some examples of xrConfig()
:
-
Run with Docker at a
27980
port: - Run with sign verification:
Debug helpers
This xrDebug PHP client provides the following helper functions in the root namespace. Use these anywhere in your code.
Function | Purpose |
---|---|
xr | Dump one or more variables |
xrr | Dump raw message |
xri | Dump inspector (pauses, etc) |
xr
Use function xr($var1, $var2,...)
to dump one or more variable(s).
Pass a topic using t:
.
Pass an emote using e:
.
Pass bitwise flags to trigger special behavior.
f: XR_BACKTRACE
to include debug backtrace.
xrr
Use function xrr()
to send a raw message.
xri
Use function xri()
to interact with the inspector.
Use pause
to pause code execution.
Use memory
to send memory usage information.
Debug helpers (VarDump)
This xrDebug PHP client also provides the following helper functions provided by the VarDump package.
Function | Purpose |
---|---|
vd | VarDump to output stream |
vdd | VarDump to output stream and die |
vd
Function vd
is a drop-in replacement for var_dump
. It prints information about one or more variables to the output stream.
vdd
Function vdd
does same as vd, but with die(0) which halts further execution.
Exception handling
The PHP client provides a throwable handler that can hook or replace existing exception handler logic thanks to the ThrowableHandler package.
Register handler
Use registerThrowableHandler
to enable xrDebug throwable handling.
Error handling
To handle errors with xrDebug you will require to configure your project to handle errors as exceptions and register a shutdown function:
Triggered handler
Use throwableHandler
in any existing exception handler logic:
Custom inspectors
Extra inspectors can be defined to provide more context aware debug information. To create a custom inspector use XrInspectorTrait
to implement the XrInspectorInterface
and use sendCommand
method.
For code below, myDump
defines a method that will stream data from your application logic and myPause
sends a pause with debug backtrace by default.
The method sendCommand
enables to interact with the existing xrDebug instance.
Null inspector
A null inspector is required to void any inspection call if xrDebug is disabled. The null inspector should implement the same methods as the real inspector, but without carrying any action.
💡 Use XrInspectorNullTrait
to implement the XrInspectorInterface
when providing null inspector.
Helper function for custom inspector
To use your custom helper:
Documentation
Documentation available at docs.xrdebug.com.
License
Copyright Rodolfo Berrios A.
xrDebug is licensed under the Apache License, Version 2.0. See LICENSE for the full license text.
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
All versions of xr with dependencies
ext-curl Version *
ext-json Version *
chevere/filesystem Version ^1.0.0
chevere/message Version ^1.0.0
chevere/standard Version ^1.0.1
chevere/throwable-handler Version ^1.0.2
chevere/trace Version ^2.0.0
chevere/var-dump Version ^2.0.1
phpseclib/phpseclib Version ~3.0