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 79in 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
Introducing the Flare CLI
Manage your errors, projects, and performance data straight from the terminal with the new Flare CLI. Install it via Composer and get full access to your Flare dashboard without opening a browser.
Alex
Let your AI coding agent fix errors and review performance
Give your AI coding agent direct access to your errors and performance data with a single command. No MCP server needed. Just install the skill and let your agent investigate, fix, and triage issues without leaving the terminal.
Alex
Subscribe to Backtrace, our quarterly Flare newsletter
No spam, just news & product updates