---
url: https://simpledatalogs.com/docs/quickstarts/laravel.md
description: >-
  Send events, Eloquent model changes, sign-ins and logs from Laravel to
  simpledatalogs in one minute, without cron.
---

# Laravel

## Install

```sh
composer require simpledatalogs/laravel
```

```sh
# .env
SIMPLEDATALOGS_KEY=sdl_sec_…
```

`npx simpledatalogs init` in the project folder adds the key line for you and sends a test event.

## Add it

```php
use SimpleDataLogs\Laravel\Facades\SimpleDataLogs;

SimpleDataLogs::track('signup', ['plan' => 'pro']);
```

Events leave after each response; no cron needed.

## Send more with one line each

```php
// A model: order_created, order_updated (changed attribute names only), order_deleted, order_restored.
class Order extends Model
{
    use \SimpleDataLogs\Laravel\TracksModelEvents;
}
```

```sh
# Sign-ins, sign-outs and sign-ups, and the user's id on every event.
SIMPLEDATALOGS_TRACK_AUTH=true
```

```php
// A log channel, in config/logging.php.
'tap' => [\SimpleDataLogs\Laravel\ForwardToSimpleDataLogs::class . ':daily'],
```

## In the first minute

* Your `track()` events, and model events with `model`, `model_id` and `changed`.
* `user_logged_in` with a `user_id`, once auth tracking is on.
* Forwarded log lines on the **Logs** tab.
* One telemetry bundle per request, job, scheduled task and Artisan command, with its queries, outgoing calls and exceptions, on the **App** and **Issues** tabs.

## Defaults

| Feature | Default |
|---|---|
| Model events | per model, with the trait; values never sent unless listed in `$trackedAttributeValues` |
| Auth events | off (`SIMPLEDATALOGS_TRACK_AUTH`) |
| Telemetry | on once the key is set; `SIMPLEDATALOGS_TELEMETRY=false` turns it off |
| Sending | after each response (`SIMPLEDATALOGS_DELIVERY=terminate`); `queue` or `schedule` instead |

Everything else is in the [Laravel SDK](/sdks/laravel) reference.
