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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wouldn't it be better to have in composer.json just PHP version dependancy? #202

Open
thorewi opened this issue Jan 20, 2022 · 7 comments
Open

Comments

@thorewi
Copy link

thorewi commented Jan 20, 2022

Hello,

Wouldn't it be better to have in composer.json just PHP version dependancy? And deal with everything else via phar. Similar to https://github.com/phpstan/phpstan.

I would like to install it via composer but sometimes I have dependencies in my project which conflicts with those in cachetool. Then I need to install it via

curl -sLO https://github.com/gordalina/cachetool/releases/latest/download/cachetool.phar
chmod +x cachetool.phar

but I'm losing PHP version check.

Thank you.

@gordalina
Copy link
Owner

This is a very good idea!

@codegain
Copy link

Hi,

I would like to propose a solution like https://github.com/qossmic/deptrac: There is a seperate repository (https://github.com/qossmic/deptrac-shim) which just contains the .phar file. That way the tool is still installable via composer and is auto-updated via composer update. Callable via vendor/bin/deptrac

@staabm
Copy link

staabm commented Sep 6, 2022

just came here to also open a similar issue. having a zero dependency cachetool would be perfect.
we use the phpstan and also the deptrac-shim and both work great for us.

to add another example: there is also a php-cs-fixer shim for a few months: https://github.com/PHP-CS-Fixer/shim

@mbrodala
Copy link
Contributor

So this is about providing a Phar package of this tool. Either as separate package with a dedicated package name or by building and providing the Phar as bin/cachetool.

See e.g. Deployer for an example of the latter:

@staabm
Copy link

staabm commented Mar 27, 2024

one other thing which could work alternatively. if cachetool would be distributed as a executable file it would be self contained und would even work without php beeing installed, see https://github.com/crazywhalecc/static-php-cli

@sanderdlm
Copy link
Contributor

sanderdlm commented Jun 6, 2024

Not really trying to plug my own project here, but I ran into the same issue last year. I had to get this working for a lot of different projects, running a lot of different PHP versions, sometimes on the same server. In the end I replicated the opcache:reset functionality (because I only needed that command) into a separate package with only 1 dependency. Might be useful for anyone here too: chop

@mbrodala
Copy link
Contributor

Notice that this would probably also help solving #238.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants