- Is knplabs/knp-piwik-client-bundle a Laravel package?
- No. It is a Symfony2 bundle that wires the KNP Piwik client into Symfony's dependency injection container and configuration system. Laravel has no bundle concept, so the framework-specific value does not transfer to a Laravel application. The underlying client is a thin wrapper over the Piwik/Matomo HTTP tracking API.
- Can I use KnpPiwikClientBundle in a Laravel app?
- Not without pulling in Symfony's DI, config, and HTTP kernel components alongside Laravel's container, which creates two competing service containers. The practical path is to skip the bundle and instantiate the client or call the Matomo API directly. If you discard the bundle scaffolding, you are not really adopting the package, just one class plus a dead dependency.
- How do I install knplabs/knp-piwik-client-bundle?
- In a Symfony app you install it with Composer, register the bundle, and configure the knp_piwik host, site ID, and token. In Laravel this is not recommended because Symfony2-era constraints conflict with modern Laravel and PHP versions. Expect dependency resolution failures or a need for platform requirement overrides.
- Which Laravel versions support KnpPiwikClientBundle?
- None officially. It targets Symfony2, which is long end-of-life, and its Composer constraints predate Laravel 10 and 11 and PHP 8.1 and newer. Installing it in a modern Laravel project will likely fail resolution or require platform requirement overrides. Treat a successful install as the start of validation, not proof of compatibility.
- How do I send Matomo tracking events from Laravel without this bundle?
- Use Laravel's Http client behind a small service class that posts to the Matomo Tracking API. Bind it through an interface and gate the tracker URL, site ID, and token_auth through config/*.php. This keeps credentials environment-aware and avoids Symfony components. A maintained Matomo PHP client is also an option if you prefer an SDK.
- What is the difference between the Matomo Tracking API and Reporting API?
- The Tracking API accepts server-side page views, events, goals, and custom variables, which is what this bundle targets. The Reporting API runs authenticated queries to retrieve analytics data and is not the bundle's focus. Confirm which one you need before evaluating any client. If you need reporting, a maintained reporting client or direct API calls fit better.
- Is KnpPiwikClientBundle still maintained?
- No. The repository is archived and unmaintained, with KnpLabs publicly asking for a new maintainer. There is no security response, PHP compatibility work, or Matomo API drift fixes. Low stars and zero dependents mean no community validation or fallback knowledge base. Every CVE and API change becomes yours to handle if you fork.
- What are good alternatives to KnpPiwikClientBundle for Laravel?
- The preferred option is a thin Laravel service using the Http client against the Matomo Tracking or Reporting API. Also consider an actively maintained Matomo PHP client that supports modern PHP and Composer. Only vendor the bundle's request-building logic if it encodes quirks you cannot reproduce, and only after the first two options are ruled out. Do not install the bundle itself in a Laravel app.
- How do I configure the Piwik client in KnpPiwikClientBundle?
- Through Symfony bundle config, typically YAML, with host, site ID, and token, which feeds the knp_piwik.tracker service. The authoritative config surface is DependencyInjection/Configuration.php, not the README. In Laravel, replicate the same values in a config file and inject them into your own client. Keep secrets out of code and environment-specific.
- How should I test Matomo tracking in a Laravel integration?
- Fake the HTTP layer and assert the outgoing request URL, site ID, and tracking parameters for page views, events, and goals. Keep a small contract test against a staging Matomo instance to catch API drift. Do not rely on the bundle's Symfony wiring in tests. Test your service class, not dead scaffolding.