polysource / widgets
Polysource — composable dashboard widgets: counters, top-N lists, sparklines.
Package info
Type:symfony-bundle
pkg:composer/polysource/widgets
v1.1.1
2026-08-07 15:15 UTC
Requires
- php: >=8.2
- polysource/core: ^0.1 || ^0.2 || ^0.3 || ^0.4 || ^0.5 || ^0.6 || ^0.7 || ^0.8 || ^0.9 || ^0.10 || ^0.11 || ^1.0
- symfony/config: ^6.4 || ^7.0 || ^8.0
- symfony/dependency-injection: ^6.4 || ^7.0 || ^8.0
- symfony/http-kernel: ^6.4 || ^7.0 || ^8.0
- symfony/translation: ^6.4 || ^7.0 || ^8.0
- symfony/yaml: ^6.4 || ^7.0 || ^8.0
- twig/twig: ^3.0
Requires (Dev)
- phpunit/phpunit: ^10.5 || ^11.5
This package is auto-updated.
Last update: 2026-08-07 15:37:50 UTC
README
Dashboard widgets for Polysource — KPI counters, top-N lists, sparkline charts.
Part of the Polysource monorepo. MIT-licensed.
What it ships
WidgetInterface(5-method contract) +AbstractWidgetbase.- 3 concrete widgets:
CounterWidget— KPI counter ("12 failed messages", "$45 678 revenue today")ListWidget— top-N list ("5 most recent orders")ChartWidget— sparkline chart (with a textual fallback)
Dashboardimmutable VO +DashboardRegistry(tagged_iteratorpolysource.widgets.dashboard).DashboardExtensionTwig extension (render_widget(),render_dashboard(Dashboard|string),polysource_dashboards()).- 4 Bootstrap 5 templates (dashboard layout + counter/list/chart partials).
See ADR-022. Dashboards are composed in code; drag-drop composition is not planned.
Install
composer require polysource/widgets
Register the bundle:
return [ Polysource\Widgets\PolysourceWidgetsBundle::class => ['all' => true], ];
Extend it
WidgetInterface is 5 methods, and AbstractWidget already answers three of them from its constructor (id, title, columnSpan). A custom tile is the two that vary:
#[AutoconfigureTag('polysource.widgets.dashboard')] final class IncidentRotatorWidget extends AbstractWidget { public function __construct(private readonly IncidentRepository $incidents) { parent::__construct('incident_rotator', 'On-call rotation', columnSpan: 6); } public function getTemplate(): string { return '@App/widgets/incident_rotator.html.twig'; } public function getViewData(): array { /* return what your template needs */ } }
See extensibility map.