PhileCMS / Phile

A flat file CMS with a swappable parser and template engine.
https://philecms.github.io/
Other
256 stars 48 forks source link

Can't install third party Phile plugin via composer #298

Closed Schlaefer closed 6 years ago

Schlaefer commented 8 years ago

Expected behavior

Plugin installs.

Actual behavior

Plugin installation fails.

$ composer require siezi/phile-total-cache

Using version ^2.0 for siezi/phile-total-cache
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Installation request for phile-cms/phile No version set (parsed as 1.0.0) -> satisfiable by phile-cms/phile[No version set (parsed as 1.0.0)].
    - siezi/phile-total-cache 2.0.0 requires phile-cms/phile >=1.5.0 -> satisfiable by phile-cms/phile[1.5.0, 1.5.1, 1.5.2, 1.6.0, 1.7.1].
    - Can only install one of: phile-cms/phile[1.5.0, No version set (parsed as 1.0.0)].
    - Can only install one of: phile-cms/phile[1.5.1, No version set (parsed as 1.0.0)].
    - Can only install one of: phile-cms/phile[1.5.2, No version set (parsed as 1.0.0)].
    - Can only install one of: phile-cms/phile[1.6.0, No version set (parsed as 1.0.0)].
    - Can only install one of: phile-cms/phile[1.7.1, No version set (parsed as 1.0.0)].
    - Installation request for siezi/phile-total-cache ^2.0 -> satisfiable by siezi/phile-total-cache[2.0.0].

Steps to reproduce the behavior

  1. create a composer installable Phile plugin, e.g. https://github.com/Schlaefer/phileTotalCache
  2. require a Phile version greater than (but not equal) 1.0.0 (e.g. https://github.com/Schlaefer/phileTotalCache/blob/master/composer.json#L9)
  3. Install that plugin composer require siezi/phile-total-cache

    Additional information

This is the problem I run into when there's no version information in Phile's composer.json.

As far as I can see composer can't figure out Phile's current version (e.g. 1.7.1) and then assumes that's 1.0.0 which doesn't meet the minimum plugin requirements.

Does someone know what's wrong here?

Schlaefer commented 8 years ago

In the meantime my memory came back. Yes, this was my 1.5.0 issue.

Let's consider this example because it's the easiest to grasp: you download the Phile zip from the homepage or you "find" an existing Phile installation. Composer, packagist or git were never involved in the installation. Then you try to install an plugin via composer, but this plugin requires a certain minimum root package (i.e. Phile) version. Now, how is composer supposed to figure out the version of the root package installed?

The only solution I found back then was to have the version string in composer.json. If it's there composer picks it up. Otherwise: no idea.

kicken commented 8 years ago

The version string could be added as an extra step when building a .zip for distribution.

Another alternative would be to do something like Symfony where rather than create a project based on the Phile repository, one created a project based on a separate skeleton repository which includes phile as a dependency in it's composer.json file.