Download the PHP package multek/laravel-business-metrics without Composer

On this page you can find all versions of the php package multek/laravel-business-metrics. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-business-metrics

Laravel Business Metrics

Server-side business event tracking with flexible report generation for Laravel + PostgreSQL. Get real-time dashboards in Grafana and exploratory BI in Metabase — without streaming infrastructure.

Architecture

Design principles:

Requirements

Installation

Publish config and enum stub:

Run migrations and create analytics schema:

Configuration

Edit config/business-metrics.php:

1. Register your events

Option A — Enum (recommended):

Edit app/Enums/BusinessEventType.php and uncomment/add your events:

Then point config to it:

Option B — Array:

2. Create reports

Each report is a PHP class that defines its own SQL, output table, and schedule. You get full SQL control — compute activation rates, cohort retention, revenue breakdowns, or anything that needs custom joins and data from any table.

This generates app/Reports/ActivationRateReport.php:

How incremental upsert works:

3. Register reports

4. Create tables

5. How scheduling works (zero-config)

You don't need to register anything in your scheduler. The package handles it automatically.

When you register a report in config and define its schedule() cron expression, the package's ServiceProvider automatically registers it with Laravel's scheduler:

So the full flow is:

  1. You create a report class with schedule() returning a cron expression (e.g. '0 */6 * * *')
  2. You register it in config/business-metrics.php'reports' array
  3. The package reads all reports on boot, and for each one registers a scheduled job with that cron
  4. Laravel's scheduler (php artisan schedule:run, which your server runs every minute via crontab) checks the cron and dispatches ProcessReportJob to the queue when it matches
  5. Your queue worker picks up the job, runs the report SQL, done

The only thing you need on your server is the standard Laravel crontab entry (you probably already have this):

And a queue worker running:

6. Queue configuration (optional)

Configure the queue name for report jobs in .env:

Or leave it unset to use the default queue. Report jobs are visible in Horizon, retry automatically (3 attempts, 60s backoff), and won't run concurrently for the same report (ShouldBeUnique).

7. Run reports manually

For debugging or one-off runs:

Usage

Logging events

Via Facade:

Via Trait on Models

Async events (queue)

Set in .env:

Events will be dispatched to the queue instead of writing synchronously. Use sync (null) for critical events like payments.

Artisan Commands

BusinessReport API

Each report extends Multek\BusinessMetrics\Reports\BusinessReport:

Method Required Description
table(): string Yes Target table name (e.g. analytics.activation_rate)
schema(): string Yes CREATE TABLE IF NOT EXISTS SQL
query(): string Yes INSERT INTO ... SELECT ... ON CONFLICT SQL
schedule(): string Yes Cron expression for scheduling
retentionDays(): ?int No Days to keep rows (null = keep forever)
retentionColumn(): string No Column for pruning (default: updated_at)
connection(): ?string No DB connection (default: package connection)

Grafana Queries (Examples)

Since reports produce custom tables, your Grafana queries match your report schema:

Connecting Dashboards

Grafana

  1. Add PostgreSQL data source pointing to your DB (use read-only user)
  2. Grant permissions:

  3. Create dashboards querying analytics.* tables

Metabase

Same read-only user. Point Metabase to the same DB, it will discover both public and analytics schemas for ad-hoc exploration.

Scaling Roadmap

Phase Trigger Action
Now Starting out Postgres + analytics schema + Grafana
Phase 1 Dashboard queries slow down primary Add read replica, point dashboards there
Phase 2 Complex joins, multiple sources Introduce BigQuery + dbt
Phase 3 Real-time automation needs Add Pub/Sub or Kafka

The package is designed so that when you move to a warehouse, you replicate the same business_events table and report structure — no redesign needed.

License

MIT


All versions of laravel-business-metrics with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
illuminate/support Version ^11.0|^12.0|^13.0
illuminate/database Version ^11.0|^12.0|^13.0
illuminate/console Version ^11.0|^12.0|^13.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package multek/laravel-business-metrics contains the following files

Loading the files please wait ...