core23 / matomo-bundle
This bundle provides a block service for using Matomo inside symfony applications.
Package info
github.com/nucleos/NucleosMatomoBundle
Type:symfony-bundle
pkg:composer/core23/matomo-bundle
Requires
- php: ^8.3
- ext-json: *
- psr/http-client: ^1.0
- psr/http-factory: ^1.0
- psr/http-message: ^1.0 || ^2.0
- psr/log: ^1.0 || ^2.0 || ^3.0
- sonata-project/block-bundle: ^4.21 || ^5.0
- sonata-project/form-extensions: ^1.19 || ^2.0
- symfony/config: ^7.4 || ^8.0
- symfony/dependency-injection: ^7.4 || ^8.0
- symfony/expression-language: ^7.4 || ^8.0
- symfony/form: ^7.4 || ^8.0
- symfony/framework-bundle: ^7.4 || ^8.0
- symfony/http-foundation: ^7.4 || ^8.0
- symfony/http-kernel: ^7.4 || ^8.0
- symfony/options-resolver: ^7.4 || ^8.0
- symfony/stimulus-bundle: ^2.2
- symfony/twig-bundle: ^7.4 || ^8.0
- twig/extra-bundle: ^2.0 || ^3.0
- twig/intl-extra: ^2.12 || ^3.0
- twig/twig: ^2.4 || ^3.0
Requires (Dev)
- ergebnis/composer-normalize: ^2.0.1
- nyholm/psr7: ^1.0
- symfony/browser-kit: ^7.4 || ^8.0
- symfony/console: ^7.4 || ^8.0
- symfony/http-client: ^7.4 || ^8.0
- symfony/yaml: ^7.4 || ^8.0
Suggests
- symfony/http-client: Symfony HTTP client implementation
This package is auto-updated.
Last update: 2026-05-02 20:51:22 UTC
README
This bundle provides a wrapper for using the matomo (Piwik) statistic inside the symfony sonata-project.
Installation
Open a command console, enter your project directory and execute the following command to download the latest stable version of this bundle:
composer require nucleos/matomo-bundle
# To define a default http client and message factory
composer require symfony/http-client nyholm/psr7
Enable the Bundle
Then, enable the bundle by adding it to the list of registered bundles in config/bundles.php file of your project:
// config/bundles.php return [ // ... Nucleos\MatomoBundle\NucleosMatomoBundle::class => ['all' => true], ];
Assets
It is recommended to use webpack / webpack-encore
to include the MatomoTable.js file in your page. These file is located in the assets folder.
You can use npm or yarn to load the library:
Usage
Define a http client in your configuration.
# config/packages/nucleos_matomo.yaml nucleos_matomo: http: client: 'httplug.client' message_factory: 'nyholm.psr7.psr17_factory'
Render tracking code
{{ sonata_block_render({ 'type': 'nucleos_matomo.block.tracker' }, {
'host': 'http://matomo.example.com',
'site': 1
}) }}
Render statistic graph
{{ sonata_block_render({ 'type': 'nucleos_matomo.block.statistic' }, {
'host': 'http://matomo.example.com',
'site': 1,
'token': 'MATOMO_API_TOKEN'
}) }}
License
This bundle is under the MIT license.