Where code meets community
ALPHA

Summary

FirePHP is an advanced logging system that can display PHP variables in the browser as an application is navigated. All communication is out of band to the application meaning that the logging data will not interfere with the normal functioning of the application.

PHP debugging approaches

When talking about debugging PHP code there are primarily four approaches:

  1. Error Reporting - PHP native and used to detect syntax errors and API usage violations.
  2. Print Statements - Deliberate var_dump() or print() statements by developer used to track execution flow and variables.
  3. Logging - Deliberate logging to a file or other facility used to track events, execution flow and variables.
  4. Interactive Debugging - PHP extension used by developer to directly interact with a running script to track live variable state.

Using Error Reporting, Print Statements and Logging for debugging is relatively starightforward while getting Interactive Debugging to work is more involved.

See IBM: Debugging techniques for PHP programmers for introduction

Why FirePHP

The goal of FirePHP is to combine the best aspects of all four debugging approaches in an easy to install and use package.

By having all error and selected internal information about an application readily available a developer may save significant amounts of time learning, tracking and maintaining program logic.

Traditional PHP debugging solutions have primarily focused on one debugging approach at a time. FirePHP combines Error Reporting and Print Statements with Logging in an open architecture and protocol designed to support direct integration into debugging clients and integrated development environments.

DeveloperCompanion is a new client with full support for FirePHP and is being used to pioneer a combined approach to debugging where relevant information is gathered from many sources, combined and presented in a uniform interface.

DeveloperCompanion replaces the existing FirePHP Extension to facilitate logging to the Firebug Console.

The addition of Xdebug as a source of internal information is planned.

FirePHP History

FirePHP was first developed by Christoph Dorn in 2007 and has since grown to 900,000+ downloads and ~80,000 active daily users according to Mozilla Add-ons.

Christoph still develops, maintains and supports FirePHP and is the primary sponsor of the project.

FirePHP was designed to log from server-side PHP code to the Firebug Console facilitated by a FirePHP Server Library and FirePHP Firefox Extension. FirePHP gained popularily on a larger scale when Zend Framework 1.6 shipped with native FirePHP support in September 2008. Many frameworks have added FirePHP support to make it easier to use FirePHP for their users.

With the 1.0 Release the project brings many new features and is shifting 100% of its focus to further developing the Server Library only while allowing any client that implements the appropriate open protocols to access the data and services the FirePHP Server Library provides.

The first client to be fully compatible with the 1.0 Release is DeveloperCompanion which is designed to replace the FirePHP Firefox Extension for all users. An open-source client called FireConsole is planned and will be released once the underlying open source libraries in DeveloperCompanion stabilize.

FirePHP Protocol

FirePHP 1.0 does not define its own protocol but rather uses wildfire for server-client communication and insight for wrapping data into static, language agnostic, JSON-based object graphs ready for transport and storage.

Client initiated communication for specific resources as well as execution generated data sent via HTTP response headers is supported. All communication is out-of-band (to the application) meaning it will not interfere with the normal functioning of the application.

Integrating FirePHP

FirePHP consists of a PHP library that is simply included at the beginning of any PHP script and configured inline or via a configuration file. See Install for detailed instructions. By default FirePHP is disabled (to minimize overhead) and will only be activated if an authorized client is detected. The intent is to integrate FirePHP into an application and deploy it along with the application (leaving all logging statements in place) to all environments. FirePHP supports troubleshooting issues on production systems in a safe and reliable manner.

Example

define('INSIGHT_IPS', '*');
define('INSIGHT_AUTHKEYS', 'client-auth-key');
define('INSIGHT_PATHS', dirname(__FILE__));
define('INSIGHT_SERVER_PATH', '/index.php');
require_once('phar://firephp.phar/FirePHP/Init.php');

$inspector = FirePHP::to('page');
$console = $inspector->console();

$console->log('Hello World');

This example logs a Hello World message to the Firebug Console.

See Install for installation instructions.

See API for a complete reference of all API features.

License

FirePHP is licensed under the MIT License.

Support

The FirePHP Project is supported via the community forums and developer mailing list. Commercial support is also available by Christoph Dorn.

News

You can follow FirePHP on twitter: http://twitter.com/firephplib

In-depth FirePHP news and tutorials are available on Christoph's blog: http://www.christophdorn.com/Blog/category/firephp/

Homepage: Sourcemint.com

Status

Sourcemint is incomplete ALPHA technology and continuously evolving in sync with underlying and related projects. Production ready aspects will be documented and made available in time. Your Feedback is welcome and appreciated!

Who

Sourcemint is one of the results of intense focus by Christoph Dorn over the past several years and continuous exploration throughout Christoph's interest in software development over the past 15+ years.

Sourcemint is the love child of one person guided by the voices of passionate developers at the top of their game who are leading the industry into a new era of software development.

What

Sourcemint is an integral part of Christoph's work intended to realize his dream of one global toolchain under which components may be arbitrarily combined into maintainable mission critical systems by providing an all-encompassing and organized package repository from which consistent and autonomic systems may be built.

Sourcemint provides an automated software building and integration service as well as an intelligent software delivery network to distribute built software to all deployed systems and Internet users.

This means an arbitrary (code, configuration, network, ...) change may be made to a software system which can then be automatically built, tested, distributed and deployed. Every change constitutes a completely new system made possible by the fact that changes, any changes, are cheap and fully tested in every way before going live.

Just imagine what this means in your daily work.

Why

Automated software builds, continuous integration processes, streamlined issue trackers, community supported software, source control, online collaboration and automated cloud deployment have wet our appetite but hardly scratch the surface of what it actually means to have a completely automated production cycle from idea to delivery. The full potential is only realized once these separate solutions addressing different areas work together harmoniously.

What has been missing is new ways of looking at how to build software.

How

Christoph's work provides a new way to build software that is not necessarily new in the sense of ideas or technology but rather arrangement and timing. Christoph has through exploration and experimentation distilled current cutting edge technology, knowledge and wisdom into a toolchain platform called PINF available open source under the MIT license to realize a new breed of software.

Imagine software and systems that just work and are a pleasure to maintain.

Sourcemint is built entirely on PINF, as is all of Christoph's work, and can be used by any developer to tap into the power of the PINF approach to build open source or commercial libraries, frameworks, applications, systems and services.

Christoph's hope is that PINF and related projects will provide a foundation for developers to cooperate more widely and experiment with new ideas by eliminating some of the major constraints imposed by traditional toolchains. Traditional toolchains create systems that typically rot because they are practically impossible to refactor. We need a toolchain such as PINF which has refactorability designed into its core.

Let's create software that breathes with life and is in large part self-sustaining!

You

Join Christoph in his mission to help you, the developer, and help yourself by broadly applying the tools and approaches you know work to all of your work. Lean on PINF, your mind is begging you. Learn it, teach others, and let your inspiration soar!

Follow Sourcemint and PINF on twitter to watch for news of cutting-edge tools, tutorials and services coming online. You can also follow Christoph's work directly.