Hey guys! My name is Hélder and I'm writing from Lisbon, Portugal.
In my latest project divide.pt I was not sure how to handle the Exceptions (that will eventually occur) on the production server, without having to SSH and manually check the logs. So I came across Airbrake.io, a web app to collect errors from your app and organize them.
Moving on… In this short protip I will cover how you can control your app errors when it is in production.
For that we will use the awesome web app called: Airbrake.io.
A short description from their site:
Airbrake collects errors generated by other applications, and aggregates the results for review.
First of all, we need an account! If you don't have one, go and grab one at Airbrake.io. They have many plans (including a free one).
I'm assuming that you already have
composer installed. If not got to getcomposer.org.
First we need to add the Airbrake composer package:
composer.json file and then
Notice something? Its not a specific L4 composer package. So we don't need to add the aliases and providers to our
Now that we have the package in our
vendor directory we want to start sending all the exceptions to Airbrake.
Let's create a configuration file for our Airbrake API credentials. In the
config directory add a new file called
airbrake.php with the content:
'active' => true,
'API' => 'YOUR-API-KEY',
Simple and clean, right?
Now lets go to the project root and open the
start/global.php file and change the
App::error(function(Exception $exception, $code)
// keep saving the exception on the log file.
// simple on/off mechanism
$config = new Airbrake\Configuration(Config::get('airbrake.API'),
'async' => true,
'environmentName' => App::environment(),
'url' => Request::url()
$client = new Airbrake\Client($config);
Airbrake provide some configuration options. Check it at their GitHub repo.
If you don't want to send errors from you development environment just add a
config/local/airbrake.php file with:
'active' => false,
make sure you have the environment set correctly.
And that's it… simple! :)
If you have any questions leave them on the comments or drop me a line on twitter @cossou!