kunstmaan/dashboard-bundle
Dashboard bundle for the Kunstmaan CMS on Symfony, adding a configurable admin dashboard with analytics, statistics and widget blocks that surface key site metrics at a glance. Small and low-activity; intended for existing Kunstmaan projects rather than standalone use.
This bundle is a legacy Symfony 2 / Kunstmaan CMS extension, so start by confirming your stack actually matches before wiring anything up. Check the composer.json constraints, then install it alongside a compatible kunstmaan/admin-bundle / kunstmaan/node-bundle:
composer require kunstmaan/dashboard-bundle
Register the bundle in app/AppKernel.php:
new Kunstmaan\DashboardBundle\KunstmaanDashboardBundle(),
Import its routing under the admin prefix:
# app/config/routing.yml
kunstmaan_dashboard:
resource: "@KunstmaanDashboardBundle/Resources/config/routing.yml"
prefix: /admin
Then configure the Google Analytics credentials under kunstmaan_dashboard in config.yml (client id, client secret, redirect URI, and any developer key required by the version you install).
Where to look first:
DependencyInjection/Configuration.php — the authoritative list of config keys and defaults.Resources/config/services.yml — service ids, widget tags, and the GA service wiring.Controller/DashboardController.php — how widgets are collected and rendered.Widget/ — the widget contract (AbstractWidget / WidgetInterface) and built-in GA widgets.Resources/views/ — template names and override paths.First use case: get the Google Analytics dashboard rendering at /admin/dashboard. Create a Google Cloud project, enable the Analytics API, create an OAuth client with the redirect URI matching your admin host, put the credentials in config, then load the dashboard and complete the OAuth handshake. Once data appears, add a custom widget for your own KPI.
Custom widgets as tagged services. The bundle discovers widgets through a service tag, not through filesystem scanning. Create a class extending the bundle's abstract widget (confirm the exact contract in Widget/), expose a name and template, then tag it:
namespace Acme\AdminBundle\Widget;
use Kunstmaan\DashboardBundle\Widget\AbstractWidget;
class SalesWidget extends AbstractWidget
{
public function getName()
{
return 'sales';
}
public function getTemplate()
{
return 'AcmeAdminBundle:Widgets:sales.html.twig';
}
public function getData()
{
// return array passed to the template
}
}
# services.yml
acme.dashboard.widget.sales:
class: Acme\AdminBundle\Widget\SalesWidget
arguments: ['@doctrine.orm.entity_manager']
tags:
- { name: kunstmaan_dashboard.widget, alias: sales }
Keep widget data retrieval out of the template. The built-in GA widgets follow a pattern of querying a service, normalizing the result, and handing a plain array to Twig. Mirror that: inject the GA service (or your repository) into the widget, do the date-range math in PHP, and keep the template dumb. This makes the widget testable and lets you swap the data source later.
Reuse the GA service directly. You do not have to render through the dashboard to benefit from the integration. Inject the bundle's analytics service into your own controllers or commands, request a metric/dimension set for a date range, and render it wherever you need. This is the most durable way to use the package: treat it as a GA client with a dashboard UI attached.
Warm the cache with a command. GA API calls are slow and rate-limited. If the bundle exposes a fetch/refresh command (bin/console list kunstmaan:dashboard to confirm), schedule it via cron and have widgets read from cache/DB rather than calling Google on every admin page load. If no such command exists, write your own console command that calls the same service and persists the result.
Override templates via the standard Symfony path. Copy the original from Resources/views/ into app/Resources/KunstmaanDashboardBundle/views/ and edit there. Do not modify the vendor directory.
Integrate with the admin menu by adding your dashboard route to the Kunstmaan admin menu configuration rather than hard-linking; this keeps permissions and active-state handling consistent with the rest of the CMS.
composer why-not before assuming it will install.bin/console debug:container --tag=kunstmaan_dashboard.widget. Common causes: service not public, missing alias, or the compiler pass not registered because the bundle was added after cache warmup.getTemplate() string often surfaces as a Twig loader error deep in the dashboard render, not at the widget. Double-check bundle notation (AcmeAdminBundle:Widgets:file.html.twig) versus the newer @AcmeAdmin/... syntax; this bundle predates the latter.app/logs/ first, then the Symfony profiler for the dashboard request, then debug:container for the widget and GA services. If the dashboard route 404s, the routing import is missing or the prefix conflicts with another admin route.How can I help you explore Laravel packages today?