The main goal of Flare is to be the best error tracker for Laravel applications. Since we started, many people are asking how they can use Flare with other PHP applications that they run and how this works. For this purpose, we released a plain PHP SDK that also powers Flares Laravel client Ignition under the hood.
In this article, we are using Flare to track errors in a Laravel Lumen application.
At first, you need to create a new project at Flare to get your Flare application key and access the Flare API. You can do this on your project overview here.
The second step is to install the Flare PHP client package via composer:
composer require facade/flare-client-php
The next step is to make sure that you are loading the default AppServiceProvider
in Lumen. The service provider is not loaded by default, but you can do that by uncommenting line 79
in the bootstrap/app.php
in your Lumen project directory. It should look like this:
$app->register(App\Providers\AppServiceProvider::class);
The last step is to send all errors from your Lumen application to Flare. This is quite simple and works by registering the Flare handlers within the AppServiceProvider
. For a default Lumen install, it looks like this:
<?php
namespace App\Providers;
use Facade\FlareClient\Flare;
use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider
{
/**
* Register any application services.
*
* @return void
*/
public function register()
{
Flare::register('ZHb7j15RDQ1adLHjXSNWdsinSu1dhyMr')->registerFlareHandlers();
}
}
Make sure you use your own APP_KEY
and do not add the key directly in the file as this file is version controlled, and you don't want to have credentials in there. A better practice is to add this key to the .env
file.
Continue reading
Lessons from the deep end
20 months ago, we started building Performance Monitoring as Flare’s next big feature, never expecting Laravel’s rapid commercial growth to put us in direct competition with their own tools. This is our honest take on those 20 months went, how we’re adapting to this new reality, and where we’re heading next while staying true to who we are. A dive into the deep end, without knowing how far down it goes.
Alex
Connect your AI agent to Flare to automatically fix production and performance problems in PHP and Laravel projects
You can now use our MCP server to connect your AI agent to Flare. This way your AI has all context it needs to diagnose and fix production and performance problems.
Freek
Subscribe to Backtrace, our quarterly Flare newsletter
No spam, just news & product updates