@sebastian-lenz opened this Issue on June 17th 2020

I've just tried to install Matomo directly from the repository / via composer and the installation fails due to this requirement in composer.json:

"leafo/lessphp": "dev-php74-compat"

As it turns out, there is no such version as "dev-php74-compat", see https://packagist.org/packages/leafo/lessphp

@sebastian-lenz commented on June 17th 2020

Ah, I've found it, you define your own repository a few lines below:

However, this makes it impossible to depend on Matomo as a dependency installed by composer.

@Findus23 commented on June 17th 2020 Member

Hi, see https://github.com/matomo-org/matomo/pull/15180 for more information on why this is a slightly ugly hack.

Matomo 3.x supports PHP 5.5 or later, so it can not be updated to the latest version of lessphp(which dropped support a while ago).

But Matomo also needs to support PHP 7.4 which means this patch (https://github.com/matomo-org/lessphp/commit/f16f6984aa9098559ababa9f47154a397b974c24) needs to be applied to avoid warnings.

With Matomo 4 support for old PHP versions is dropped so it should not matter anymore, but this means https://github.com/leafo/lessphp/pull/647 still needs to be merged.

@tsteur commented on June 17th 2020 Member

If this is resolved in Matomo 4 basically can we close this issue? Or we still wait for the other issue to be merged?

@sebastian-lenz commented on June 18th 2020

The composer file on branch 4.x-dev also contains references to the version dev-php74-compat of the module leafo/lessphp that only can be installed when directly cloning the Matomo repository and it is still not possible to depend on Matomo as a package / requirement / dependency.

The problem

In the current state, installing Matomo using the following command is not possible:

composer require piwik/piwik

The command fails with an error like this:

Using version ^3.13 for piwik/piwik
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - piwik/piwik 3.13.6 requires leafo/lessphp dev-php74-compat -> no matching package found.

Which is sad cause is both prevents users from installing and updating Matomo using composer and also makes it impossible to create other projects that depend on Matomo.

The cause

The core issue is that Matomo currently relies on two private packages that must be installed from custom repositories as configured in Matomos composer file but composer does not load the repositories of requirements:


Currently, every package that depends on Matomo must repeat the repositories section in their own composer.json.

The solution

Get rid of the section repositories in composer.json by either:

  • publishing the required packages to the public composer repository
  • switching to alternatives that are already publicly available
  • moving the code to the own package
  • removing the packages by creating the compiled assets at build time
@creativecoder commented on November 25th 2020

Seeing the 4.0 release, I just tried to upgrade my composer based matomo project to v4.0 and found this same issue

Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Root composer.json requires matomo/matomo ^4.0 -> satisfiable by matomo/matomo[4.0.0].
    - matomo/matomo 4.0.0 requires leafo/lessphp dev-php74-compat -> found leafo/lessphp[dev-master, dev-pull-523, v0.3.5, ..., v0.5.0] but it does not match the constraint.

It'd be great to get this resolved now that v4 is released, so composer support isn't broken.

@Findus23 commented on November 25th 2020 Member

@creativecoder I think to be able to go back to the normal upstream release, this pull request needs to be merged as without it lessphp won't work in Matomo when using PHP 7.4 or above.

Once this is done and there is a new lessphp release (this part is optional as we could depend on a commit hash) we can simply use it instead.

@sgiehl commented on November 25th 2020 Member

I will check how easy it would be to maybe switch to https://github.com/wikimedia/less.php instead. Should be more maintained 🙈

@Findus23 commented on November 25th 2020 Member

@sgiehl Considering that there is a section about this this could be surprisingly easy (I didn't know that there was another PHP implementation).

Especially as it should not change the rest of the asset handling (as long as it compiles the css the same). (even though supporting source maps would be really nice for the future)

This Issue was closed on December 10th 2020
Powered by GitHub Issue Mirror