Laravel
Install the package and every HTTP request, Eloquent query, and unhandled exception is captured automatically. Zero boilerplate.
Installation
composer require fanar-app/fanar The service provider is auto-discovered. No manual registration required.
Environment variables
# .env
FANAR_HOST=127.0.0.1
FANAR_PORT=23517
FANAR_ENABLED=true | Variable | Default | Description |
|---|---|---|
| FANAR_HOST | 127.0.0.1 | Hostname of the machine running Fanar |
| FANAR_PORT | 23517 | Port the Fanar desktop app is listening on |
| FANAR_ENABLED | true | Set to false to disable without removing the package |
What gets captured automatically
- Every HTTP request — method, path, status code, duration, query count
- All Eloquent and DB queries — SQL, bindings, execution time
- Unhandled exceptions — with full stack trace
Queries and exceptions are grouped under their originating request in the feed.
Eloquent model events
Add the HasFanarLogging trait to any model to capture created, updated, and deleted events. Updated models also include a _changes diff showing only the changed attributes.
use Fanar\Laravel\HasFanarLogging;
class Order extends Model
{
use HasFanarLogging;
} Each event appears in the feed labelled Order::created, Order::updated, etc., with the model's full attribute payload.
To observe a model without modifying it, register the observer manually:
use Fanar\Laravel\FanarModelObserver;
// In a service provider or AppServiceProvider::boot()
Order::observe(FanarModelObserver::class); Manual calls
Use the fanar() helper anywhere — controllers, jobs, commands, services. Type is inferred automatically.
fanar('processing order #' . $order->id); // log
fanar($order->toArray()); // object — JSON tree
fanar($e); // exception — stack trace
fanar($user, ['label' => 'signup', 'project' => 'auth']); Or use the static API directly:
use Fanar\Fanar;
Fanar::log('processing order #' . $order->id);
Fanar::dump($order->toArray());
Fanar::exception($e);
$t = Fanar::time('csv-import');
importCsv($file);
$t->stop();