Detect matomo version number with php


(Adrian Ministrator) #1

I am looking for a way to find out the current version number of the installation in a separate PHP script (identical Documentroot). Any ideas?


(Lukas Winkler) #2

Hi,

There is an HTTP API, which returns the installed version:
https://demo.matomo.org/index.php?module=API&method=API.getMatomoVersion&format=JSON&token_auth=anonymous

You may need to add the auth token of a user with read access to at least one site.


(Adrian Ministrator) #3

I found the HTTP API - but im inside a docker container without curl or smth.
I saw there is a class calle /piwk/core/Version.php with a const named VERSION - how to use these class?


(Lukas Winkler) #4

Hi,

The following works for me:

require_once "core/Version.php";

echo Piwik\Version::VERSION;

(Adrian Ministrator) #5

hi lukas - thanks (i’ve tried this yesterday with an error) - maybe today is a better day.