polysource/widgets

Polysource — composable dashboard widgets: counters, top-N lists, sparklines.

Maintainers

Package info

github.com/polysource/widgets

Homepage

Issues

Type:symfony-bundle

pkg:composer/polysource/widgets

Transparency log

Statistics

Installs: 6

Dependents: 0

Suggesters: 0

Stars: 0

v1.1.1 2026-08-07 15:15 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) + AbstractWidget base.
  • 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)
  • Dashboard immutable VO + DashboardRegistry (tagged_iterator polysource.widgets.dashboard).
  • DashboardExtension Twig 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.

Documentation