Git Product home page Git Product logo

php-debug's Introduction

Atom PHP Debugging Package

Debug PHP code using the Xdebug PHP Extension.

Features

  • Interactive Console
  • Breakpoints
  • Watches
  • Multiple Debug Sessions
  • Path Mappings
  • Step through debugging (Over, In, Out)
  • Stack and Context views
  • UTF8 Support
  • Uses atom-debug-ui

This is currently an alpha release, and still in active development.

Getting Started

Install Xdebug

You may already have Xdebug installed. Check the results of the phpinfo function for xdebug information. If no xdebug section exists, you likely need to install this. *nix users can likely find it within their package manager of choice. Alternative installation or compiling instructions are available here.

Setting up Xdebug

xdebug.remote_enable=1
xdebug.remote_host=127.0.0.1
xdebug.remote_connect_back=1    # Not safe for production servers
xdebug.remote_port=9000
xdebug.remote_handler=dbgp
xdebug.remote_mode=req
xdebug.remote_autostart=true

With these settings, PHP will connect to your editor for every script it executes. The alternative is to switch xdebug.remote_autostart to false, and install an Xdebug helper extension for your browser of choice, such as:

These browser extensions will give you a button within your browser to enable/disable Xdebug. The extensions might have configuration options for an "IDE key" (which is used for an XDEBUG_SESSION cookie). The IDE key for Atom with PHP Debug is "xdebug-atom".

It is also possible to run a php script from the command line with Xdebug enabled. You can find more information on this at the Xdebug documentation for Starting The Debugger. See can find a complete list and explanation of Xdebug settings here.

Start Debugging

To begin debugging:

  1. Open up your PHP file in atom
  2. Add a breakpoint:

Move the cursor to a line you want to break on and set a breakpoint by pressing Alt+F9, selecting Toggle Breakpoint from the Command Palette (ctrl+shift+p)or with the php-debug menu (Packages -> php-debug->Toggle Breakpoint). This will highlight the line number green, to indicate the presence of a breakpoint.

  1. Open the debug view by pressing ctrl+alt+d, selecting 'Toggle Debugging' from the Command Palette or php-debug menu.
  2. Start the script with Xdebug enabled. If everything is setup correctly, the entire line of the breakpoint will be highlighted in green, indicating the current line of the script.

If everything worked correctly, you can now use the various buttons/commands to step through the script.

Settings

Server Port

This is the port that the atom client will listen on. Defaults to 9000

Server Address

This is the address that the atom client will listen on. Defaults to 127.0.0.1

Xdebug DBGP Protocol Debugging

Outputs protocol debugging messages to the atom debug console

Xdebug: Max Depth

Max depth for variable scopes

Xdebug: Max children

Maximum number of array elements to show in variables

Xdebug: Max Data

Maximum data for variables

Display: Sort Arrays/Object alphabetically

Sort Arrays/Object alphabetically instead of by php default

Display: Status Bar

Allow PHP Debug to be opened from the status bar

Exceptions

Default exceptions and errors for PHP-Debug to break on

Path Maps

Pathmaps are now configured for each project folder during connection

php-debug's People

Contributors

cchamplin avatar gwomacks avatar stamourd avatar driskell avatar uzitech avatar thepetermick avatar phlak avatar torsday avatar jigarius avatar lucascaro avatar qwertyzw avatar darthrevan13 avatar pictus avatar

Watchers

James Cloos avatar Nikita Rushmanov avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.