Skip to content

Repository files navigation

VSCode WSL Remote Xdebug Link Support

This package now supports generating Xdebug file links for VS Code running in WSL (Windows Subsystem for Linux) via the vscode-wsl editor type.

Usage

Set the editor link template to vscode-wsl:

$wslName = getenv('DEBUGBAR_WSL_NAME') ?: 'Ubuntu';
$collector->setXdebugLinkTemplate("vscode://vscode-remote/wsl+{$wslName}/%f:%l");

Or, if your collector supports a more generic editor link template method:

// usage: $collector->setEditorLinkTemplate('vscode-remote', 'wsl+Ubuntu');
$collector->setEditorLinkTemplate('vscode-remote', 'wsl+Ubuntu');

You can configure the WSL distribution name (e.g., Ubuntu) using:

  • The DEBUGBAR_WSL_NAME environment variable
  • The setWslName() method

If not set, it defaults to Ubuntu.

Example Link

The generated link will look like:

vscode://vscode-remote/wsl+Ubuntu/path/to/file.php:1

Clicking this link in your browser on Windows will open the file in VS Code inside your WSL environment.

PHP Debug Bar

Latest Stable Version Total Downloads License Tests

Displays a debug bar in the browser with information from php. No more var_dump() in your code!

Note: Debug Bar is for development use only. Never install this on websites that are publicly accessible.

Screenshot

Features:

  • Generic debug bar
  • Easy to integrate with any project
  • Clean, fast and easy to use interface
  • Handles AJAX request
  • Includes generic data collectors and collectors for well known libraries
  • The client side bar is 100% coded in javascript
  • Easily create your own collectors and their associated view in the bar
  • Save and re-open previous requests
  • Very well documented

Includes collectors for:

Checkout the demo for examples and phpdebugbar.com for a live example.

Integrations with other frameworks:

(drop me a message or submit a PR to add your DebugBar related project here)

Installation

The best way to install DebugBar is using Composer with the following command:

composer require --dev php-debugbar/php-debugbar

Quick start

DebugBar is very easy to use and you can add it to any of your projects in no time. The easiest way is using the render() functions

<?php

// Require the Composer autoloader, if not already loaded
require 'vendor/autoload.php';

use DebugBar\StandardDebugBar;

$debugbar = new StandardDebugBar();
$debugbarRenderer = $debugbar->getJavascriptRenderer();

$debugbar["messages"]->addMessage("hello world!");
?>
<html>
    <head>
        <?php echo $debugbarRenderer->renderHead() ?>
    </head>
    <body>
        ...
        <?php echo $debugbarRenderer->render() ?>
    </body>
</html>

The DebugBar uses DataCollectors to collect data from your PHP code. Some of them are automated but others are manual. Use the DebugBar like an array where keys are the collector names. In our previous example, we add a message to the MessagesCollector:

$debugbar["messages"]->addMessage("hello world!");

StandardDebugBar activates the following collectors:

  • MemoryCollector (memory)
  • MessagesCollector (messages)
  • PhpInfoCollector (php)
  • RequestDataCollector (request)
  • TimeDataCollector (time)
  • ExceptionsCollector (exceptions)

Learn more about DebugBar in the docs.

Demo

To run the demo, clone this repository and start the Built-In PHP webserver from the root:

php -S localhost:8000

Then visit http://localhost:8000/demo/

Testing

To test, run php vendor/bin/phpunit. To debug Browser tests, you can run PANTHER_NO_HEADLESS=1 vendor/bin/phpunit --debug. Run vendor/bin/bdi detect drivers to download the latest drivers.

About

Debug bar for PHP

Resources

Contributing

Stars

4.4k stars

Watchers

71 watching

Forks

Releases

Sponsor this project

Used by

Contributors

Languages