@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:
https://github.com/matomo-org/matomo/blob/4.x-dev/composer.json#L94

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:

https://getcomposer.org/doc/faqs/why-can%27t-composer-load-repositories-recursively.md

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
Powered by GitHub Issue Mirror