Software

Desktop apps, eLearning and more.

Database

Database driven sites, applications, knowledge

Mobile

iPhone and Android get apps that travel

Web

Creating online businesses since 2003

Better PHP Diagnostics with ChromePHP

Published 11/07-2012

Chrome Logger

So I needed FirePHP for some diagnostics on a PHP project I'm working on...

I use Chrome almost exclusively for day-to-day development these days - Firefox really has become my second choice, and ChromePHP fills one my only remaining needs that Chrome wasn't meeting.

I needed to output SQL statements for diagnostics, and outputting intermittent<script>tags withconsole.log()statements was causing all sorts of problems - mangled mark-up, etc.

So I thought, hey, I'll pull in FirePHP. That didn't work well either. Apparently, FirePHP does not send log-messages with the actual request, which is what I thought it did (?) ... instead, it relies on the client-side tool to perform a subsequent request for the log-messages after the request that generated the messages. Which just doesn't work well.

Glimpsing through the FirePHP source-code, it's something of a mess to begin with - seems like a lot of code to do something so seemingly simple, and it doesn't really follow any modern PHP conventions, for instance the file-names are all over the place.

A little more digging revealed another project, just for Chrome, that does exactly what I wished for: ChromePHP!

ChromePHP is like FirePHP's handsome cousin. Both the client-side and server-side libraries are really simple, small, and elegant, because ChromePHP does exactly what I thought FirePHP does: it just sends backconsole.*()calls using a really simple protocol, e.g. a JSON string with the method-name and arguments for the console-object.

How much simpler could it be? More importantly, why would it need to be anymore complex than that? It works great, and took minutes to integrate and use.

In my world, FirePHP has had it's time - I'm using ChromePHP from now on.

Author

Rasmus Schultz Application Developer
Rasmus Schultz

Application Developer

comments powered by Disqus

Related Projects

Tell us your idea! ×