Download the PHP package run_as_root/business-metrics-report without Composer

On this page you can find all versions of the php package run_as_root/business-metrics-report. 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 business-metrics-report

Business Metrics Report

Automated daily and weekly business metric reports (revenue, order count) delivered to Slack and email, with week/month/year-over-year comparisons.

🚀 Features

📋 Table of Contents

🖼️ Screenshots

**Email report** **Slack report**

📦 Installation

Requirements

Install via Composer

⚙️ Configuration

Admin Configuration

Navigate to Stores → Configuration → Run as Root → Business Metrics Report to:

Field Path Default Notes
Enable Daily/Weekly Report general/daily_enabled, general/weekly_enabled enabled
Daily/Weekly Cron Schedule general/daily_cron_schedule, general/weekly_cron_schedule 0 5 * * *, 1 5 * * 1
Fluctuation Decline Threshold (%) general/fluctuation_decline_threshold -15 Shared by the dispatcher-level gate and the Slack summary banner (see below)
Only Send on Fluctuation general/only_on_fluctuation disabled When enabled, skips all channels for a run unless a metric's week-ago decline exceeds the threshold above
Enable Slack Notifications slack/enabled disabled
Bot Token / Channel ID slack/bot_token, slack/channel_id - Bot token needs the chat:write scope
Enable Email Notifications email/enabled disabled
Recipients email/recipients - Comma-separated

Cron Configuration

Two cron jobs are registered under the default cron group:

🔍 How It Works

Each cron job runs the same pipeline: DateRangeService → CollectMetricsService → NotificationDispatcher.

Date Ranges

Every report carries four date ranges: the current period plus three historical comparisons.

Report Current Week ago Month ago Year ago
Daily Yesterday Same day -7 days Same day -1 month Same day -1 year
Weekly Prev Mon-Sun Week before last Same week -4 weeks Same week -52 weeks

All dates use the store timezone (Magento\Framework\Stdlib\DateTime\TimezoneInterface).

Metrics

Two collectors run per report, in sort-order:

Metric Code Description
Revenue revenue Sum of order grand totals for processing orders with a non-zero total
Order Count order_count Number of processing orders with a non-zero total

Only orders with status processing and a non-zero grand total are included - both collectors share the same query filter chain. Additional exclusions (e.g. customer groups) can be added by registering a MetricQueryFilterInterface implementation - see Add a Metric Collector.

Metrics are aggregated across the entire installation - the built-in collectors do not filter by store or website. On a multi-store setup, reports show installation-wide totals, not per-store breakdowns.

Percentage change is calculated as ((current - historical) / historical) * 100. If historical data is zero, the change is shown as null (no data). If both are zero, change is 0%.

Notification Channels

The dispatcher iterates all registered NotificationChannelInterface implementations. Channels that are disabled are skipped silently.

Only send on fluctuation - if general/only_on_fluctuation is enabled, the dispatcher checks every metric's week-ago comparison against general/fluctuation_decline_threshold (default -15, i.e. a 15% decline) before dispatching to any channel. If no metric declined past the threshold, no channel is notified at all for that run - not Slack, not email. If disabled (default), every scheduled run notifies all enabled channels regardless of fluctuation.

Slack - posts a Block Kit summary message via the Slack Web API (chat.postMessage), then posts the full detailed report as a thread reply. Independently of the dispatcher-level gate above, if any metric shows a decline past the same threshold vs the previous week, the Slack summary message itself includes a fluctuation warning banner. Requires a Bot token (xoxb-...) with chat:write scope and a channel ID. See a sample thread reply in Screenshots.

Email - sends an HTML email (template run_as_root_business_metrics_report) to a comma-separated recipient list via Magento's TransportBuilder. See a sample rendered report in Screenshots.

Both channels have separate DailyFormatter and WeeklyFormatter implementations selected by reportType.

🔧 Extension Points

All extension point interfaces live under RunAsRoot\BusinessMetricsReport\Api\.

Add a Metric Collector

Implement Api\MetricCollectorInterface and register it:

Add a Notification Channel

Implement Api\NotificationChannelInterface and register it:

Add a Slack Report Formatter

Implement Api\Channel\Slack\SlackReportFormatterInterface and register it, then add a title:

Add an Email Report Formatter

Implement Api\Channel\Email\EmailReportFormatterInterface (return Api\Channel\Email\EmailFormattedReportInterface) and register it:

Swap the Collection Strategy

Override how metrics are collected by replacing the strategy via preference:

Key Data Classes (Api\Data\)

Class Description
DateRange Start/end DateTimeImmutable pair (UTC)
DateRangeSet The four ranges passed to every collector
ComparisonResult Percentage change + formatted current/historical values
MetricResultInterface Single collected value
MetricWithComparisonsInterface Metric value + all three historical comparisons
MetricComparisonsInterface Week-ago, month-ago, year-ago results

🏗️ Architecture

🤝 Contributing

We welcome contributions! Here's how you can help:

Development Setup

  1. Fork the repository
  2. Clone your fork: git clone https://github.com/your-username/business-metrics-report.git
  3. Create a feature branch: git checkout -b feature/your-feature-name

Code Standards

Running Checks

Pull Request Process

  1. Ensure all checks above pass
  2. Submit a pull request with a clear description
  3. Respond to code review feedback

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.


All versions of business-metrics-report with dependencies

PHP Build Version
Package Version
Requires magento/module-store Version *
magento/module-sales Version *
magento/module-cron Version *
magento/module-config Version *
magento/framework Version *
magento/module-email Version *
psr/log Version *
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 run_as_root/business-metrics-report contains the following files

Loading the files please wait ...