Register in a service provider.
$this->app->singleton('collector', fn()=>collect());
Register in a service provider. Send a http request or store in the database.
$this->app->terminating(function () {
$data = $this->app->make('collector');
});
app('collector')->push(['stats' => Str::random()]);