Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide a Composer shim for the PHAR #1028

Open
TravisCarden opened this issue Sep 12, 2023 · 8 comments
Open

Provide a Composer shim for the PHAR #1028

TravisCarden opened this issue Sep 12, 2023 · 8 comments
Labels
Build scripts PHAR Issues related to the phar file.

Comments

@TravisCarden
Copy link

馃憢 Hi, there! I like to use PHAR distributions of my Composer dependencies to minimize transitive dependencies. I see that PHPMD provides one, but only via raw download. Would you consider creating a shim package like psalm/phar, phpro/grumphp-shim, or phpstan/phpstan?

@tvbeek
Copy link
Member

tvbeek commented Sep 13, 2023

We are currently working on completing the support for Phive ( https://phar.io/ ) is that an option that can work for you?

If not I'm thinking about the best way to automate this to keep the work for the maintenance team low.

@tvbeek tvbeek added Build scripts PHAR Issues related to the phar file. labels Sep 13, 2023
@TravisCarden
Copy link
Author

TravisCarden commented Sep 14, 2023

I'm afraid Phive wouldn't work for me. (I couldn't justify adding a whole new package management system to my pipeline for a single dependency when the rest of the problem is already solved with Composer.) I can live without a PHAR Composer library for PHPMD, but I've come to think it should be considered a best practice, and I'm just kind of putting the idea out there a few places where it seems most feasible. In other words, I don't want to project any undue sense of urgency--much less ingratitude. But I'll leave the issue open in case you want to entertain the idea further. Thanks! 馃檪

@AJenbo
Copy link
Member

AJenbo commented Sep 14, 2023

I agree this is a good suggestion for how to manage dev tools as there dependencies shouldn't really influence the production portion of dependencies that happens to be shared or conflict with other tools.

Using composer for managing tools means that a project can control it's dependencies rather then using system wide installations which could lead to issues when they are updated with out projects having adjusted to the new versions (new errors detected etc.).

When phpstan made the switch they renamed the original archive to phpstan-src and created a new phar based on with the old name. I'm not sure if that is a viable solution for us but just putting it out there.

@kylekatarnls
Copy link
Member

It's feasible with a GitHub Action. Once #1030 is complete, we can add another step to copy phpmd.phar and phpmd.phar.asc and commit them in another repository.

@ravage84
Copy link
Member

It seems PHPStan doesn't support shis anymore, the Composer package is abandoned and the repo has been archived by the owner since 09.12.2019.

https://github.com/phpstan/phpstan-shim

@ravage84
Copy link
Member

I agree this is a good suggestion for how to manage dev tools as there dependencies shouldn't really influence the production portion of dependencies that happens to be shared or conflict with other tools.

Using composer for managing tools means that a project can control it's dependencies rather then using system wide installations which could lead to issues when they are updated with out projects having adjusted to the new versions (new errors detected etc.).

Actually, these issues is one of the main reasons why you don't use Composer for execution-only CLI tools, e.g. phars.

You use Composer to integrate dependencies with your project whe you need to extend/use them in your code.

@ravage84
Copy link
Member

@TravisCarden I understand your reluctance. I prefer to use Composer over anything else for organizing dependencies, even execution-only tools like PHPMD etc.

But using PHIVE is the proper way to do that as it can be used per project, not only system-wide, and still doesn't collide with the sub-dependencies from Composer.

For example, CakePHP stopped fetching PHPStan through Composer and now uses PHIVE:

https://github.com/cakephp/cakephp/blob/87eba5f374b42efc48acffc665e2d4139accc710/.phive/phars.xml#L3
https://github.com/cakephp/cakephp/blob/87eba5f374b42efc48acffc665e2d4139accc710/composer.json#L123-L130

@AJenbo
Copy link
Member

AJenbo commented Sep 15, 2023

It seems PHPStan doesn't support shis anymore, the Composer package is abandoned and the repo has been archived by the owner since 09.12.2019.

https://github.com/phpstan/phpstan-shim

Like I mentioned: "phpstan/phpstan, has switched to a PHAR file. It works the same way as phpstan-shim"

@ravage84 ravage84 added this to the 2.x (unspecific) milestone May 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Build scripts PHAR Issues related to the phar file.
Development

No branches or pull requests

5 participants