Jump to content


a PHP error reporting library I've built to finally give pretty errors

php debugging web development

  • Please log in to reply
7 replies to this topic

#1 StudioFortress



  • Joined: 10-February 10
  • Location: UK

Posted 07 July 2012 - 11:13

About a month ago I finally decided to look into wrapping PHP error reporting, to display better errors, and this is the result. PHP Error gives you prettier output, making it easier to 'get' an error in less time. This includes a fully syntax highlighted stack trace, code snippets, improved error messages, and it replaces the output so they aren't hidden behind any HTML or off screen.

What is really special is that it also works with ajax too. When an error strikes, your JS callback is put on hold, and the stack trace is displayed within the page. This allows you to fit the error, and then hit retry, without a page refresh. This feature requires no changes to your JS code, browser extensions, or anything like that. It just works out of the box.

It's also built with deployment in mind, or more how to avoid deploying it. It's simple to integrate (just two lines of code), so you don't need to tie your project to it. You can also run via php.ini, allowing you to keep it entirely out of your projects. Instructions on how to do this are provided on it's GitHub repository.

It can also be globally disabled through php.ini, in case you do accidentally deploy to production, and will only run if 'display_errors' is on anyway.

I've found this very useful on my own sites, especially when I hit an error which isn't related to what I'm working on. I get some insight when it's reported, allowing me to find and fix it slightly sooner.

I others find it as useful as I have.

#2 stevember


    'But thats just me....'

  • Tech Issues Solved: 2
  • Joined: 13-August 01
  • Location: Cornwall, UK

Posted 07 July 2012 - 11:39

wow, works really well.

1. Simple to use.
2. Great syntax highlighting.
3. More than enough info to fix.

By far best error reporting I've used.

#3 ShMaunder



  • Joined: 15-December 06
  • Location: Wiltshire, UK
  • OS: Ubuntu 12.04
  • Phone: Nexus 4

Posted 07 July 2012 - 13:52

This looks pretty good. Will give it a try laters.

Does it have CLI support as well?

#4 OP StudioFortress



  • Joined: 10-February 10
  • Location: UK

Posted 08 July 2012 - 00:01

Thanks Stevember, I'm glad you like it.

In CLI mode, it currently just goes silent, and gives you the standard PHP output. This is so you don't get tonnes of HTML blasted at you over the command line.

#5 Phouchg


    has stopped responding

  • Tech Issues Solved: 9
  • Joined: 28-March 11

Posted 09 July 2012 - 10:58

Good idea. My error reporting has thus far been print_r($something); die; :D
Will see about it.

#6 articuno1au


    Neowinian Senior

  • Tech Issues Solved: 4
  • Joined: 20-March 11
  • Location: Brisbane, Australia

Posted 09 July 2012 - 11:15

You deserve a cookie for this.

I have no use for it myself (being an ASP coder) but this is still great work >.<

#7 SkrillexPy



  • Joined: 19-May 10

Posted 09 July 2012 - 11:32

Nice work! I think you deserve to put ads or at least a donate button...

#8 OP StudioFortress



  • Joined: 10-February 10
  • Location: UK

Posted 09 July 2012 - 14:37

One of the reasons I put it as it's own site was to have the possibility of putting an ad on there. So I might definitely put one on now, or a donation button.