Getting started
Eloquentize counts what happens in your Laravel apps, such as users created or invoices issued, and shows it on one dashboard.
You install a small package, add one token, and schedule one command. You do not write any tracking code.
Before you start
You need:
- A Laravel app. The package is tested on Laravel 10 to 13 with PHP 8.1 to 8.4. Older apps work too, down to Laravel 5.6 on PHP 7.4 (see step 1).
- An Eloquentize account. Create one for free.
- Timestamps on the tables you want to track. Each model needs
created_at(or the date column you choose), and must use Laravel's timestamps. - A scheduler running on your server. This means one cron entry that runs
php artisan schedule:runevery minute. On Laravel Forge, turn on the scheduler option.
Shell access helps for the first test, but you do not need it afterwards: the scheduler runs everything.
Step 1: Install the package
Run this in your project:
composer require eloquentize/laravel-eloquentize-client
On PHP 7.4, install the dedicated branch instead:
composer require eloquentize/laravel-eloquentize-client dev-php7.4
Step 2: Add your API key
- Sign in to Eloquentize.
- Open Settings, then API Keys, and create a key.
- Copy it into your
.envfile:
ELOQUENTIZE_API_TOKEN=your_api_key_here
You can use the same key in several projects.
Step 3: Test without sending anything
Run the command with --dry and -v:
php artisan eloquentize:models-count --dry -v
--dry means nothing is sent. -v prints the details. You should see:
- the app name Eloquentize will use, between asterisks;
- the list of models it found.
If a model you expect is missing, see No models found.
Step 4: Send your first metrics
Run the same command without --dry:
php artisan eloquentize:models-count
This counts every model created today and sends the numbers to Eloquentize. Open your dashboard: your app and its metrics are created automatically. There is nothing to set up there first.
Step 5: Run it automatically
Add the command to your scheduler.
On Laravel 11 and later, edit routes/console.php:
use Illuminate\Support\Facades\Schedule;
Schedule::command('eloquentize:models-count')->hourly();
On Laravel 10 and earlier, edit app/Console/Kernel.php:
protected function schedule(Schedule $schedule): void
{
$schedule->command('eloquentize:models-count')->hourly();
}
Running it every hour keeps today's numbers up to date. For other schedules, see Schedule your commands.
Already have data?
If your app has been running for a while, you can send its past days too, in one command. See Send your history.
Next steps
- Core concepts: what a source, a line, a metric and a widget are.
- Commands and options: pick a date, a column, some models, or sum a property such as an invoice amount.
- Troubleshooting: when something does not show up.