phive icon indicating copy to clipboard operation
phive copied to clipboard

Ignore installed PHARs in composer

Open heiglandreas opened this issue 2 years ago • 1 comments

It is possible to create a separate composer.json file that contains a replace section that defines composer packages that this composer.json file replaces.

This file can automatically be injected into an existing composer.json by

a) Adding a new repositories entry of type file that references .phive b) Requiring the project so that.composer knows of it.

The second step is then to add a package to the replace section when installing it via phive.

That way it is possible to use tools via phive and still install packages for them without installing the tool a second time via composer.

This will require phive to check on every call to install whether the necessary files are in place (if not install them) and then add the package to the composer.json

I'd recommend creating a unique identifier when creating the phive.xml file and adding that to the file. That identifier can then be used to name the .phive/composer.json project. The name would then be something like phive/customproject_<unique-id>.

heiglandreas avatar Jan 22 '23 18:01 heiglandreas

That would be ideal, since otherwise it gets rather difficult to manage individual projects with additional extensions for the developer tools (like additional codestyles provided as separate packages) due to the lack of the reference to the existing developer tool as PHAR.

For example additional PHPCS rulesets / extensions (https://github.com/NexusPHP/cs-config and others), or phpstan extensions like php-dba (https://github.com/staabm/phpstan-dba).

DanielRuf avatar Apr 26 '25 13:04 DanielRuf