Skip to content

Installation

phil/reporting-bundle

Requirements

PackageVersionWhy
PHP8.5 or later, with intl, json, mbstring and sodiumFigures written in a locale; jobs as JSON; labels counted in characters; random identifiers.
phil/svg-chart^0.1The SVG images of the charts.
symfony/config, symfony/dependency-injection^8.2The bundle and its configuration.
symfony/service-contracts^3.6The locators of the sources, reports, formats and deliveries.
psr/clock, psr/event-dispatcher^1.0The moment the periods are counted from; ReportExported.

Each of these is used when it is installed:

PackageFor
symfony/ux-twig-componentThe components Dashboard, Metric and Chart.
symfony/ux-live-componentThe component LiveDashboard, whose period changes without reloading the page.
symfony/messengerReportQueue and the handlers of RunReport and RunScheduledReport.
symfony/schedulerThe phil_reporting schedule.
symfony/mailer, symfony/mimeThe mail delivery.
symfony/notifierThe notification delivery.
symfony/consolephil:reporting:export.
symfony/http-foundationReportResponses.
symfony/security-coreDashboards restricted to a role.
easycorp/easyadmin-bundleA dashboard as a page of the back office.
symfony/asset-mapperThe stylesheet mapped as phil-reporting.

Enabling the bundle

composer require phil/reporting-bundle
// config/bundles.php
return [
    // …
    Phil\ReportingBundle\PhilReportingBundle::class => ['all' => true],
];

The bundle needs a clock service, which FrameworkBundle registers. The components need TwigBundle and the translator, for their labels in the phil_reporting domain.

The stylesheet

With AssetMapper, the stylesheet is mapped as phil-reporting/reporting.css:

<link rel="stylesheet" href="{{ asset('phil-reporting/reporting.css') }}">

It is written in the phil.components cascade layer on the tokens of PHIL UX (phil/ux-css), with a value of its own for each when PHIL UX is not loaded. Its bars read their length from a data-share attribute: no inline style, so a Content Security Policy without 'unsafe-inline' for styles shows them.

The directory of the claim check

The directory store keeps the jobs and the exports under %kernel.project_dir%/var/phil_reporting, created readable by its owner only. The worker that runs the reports and the code that queues them must share it: on several machines, alias JobStore and ExportStore to services of the application, as Extension points shows.