-
Hey there, I just want to make sure I got a couple of things right – regarding the Distribute via Packagist section of the documentation about building standalone applications, do we agree that installing the app running In other words, Composer will automatically create a file in The other thing is that, while running some tests, I was able to install my app using Isn't that kind of weird/wrong? I.e. using one method to install the app (Composer) and another one to update it (PHAR self-update). And if it's wrong, is there a way to programmatically know whether the app was installed using Composer and to conditionally hide/remove the self-update command in Thanks, Yannick |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
I've answered the second question myself – while So I am now removing the self-update command when the app was installed via Composer by performing a check on the current directory ( I still would like to know whether my first assumption is correct though (i.e. Composer installs the dependencies but they are not used). |
Beta Was this translation helpful? Give feedback.
-
Regarding your first query, if you leave the dependencies in the You can see an example of this with the Oh Dear CLI:
As you have mentioned, correctly, if you specify the Regarding your second query, I agree that is a bit of a weird scenario, and does seem odd to include that. However, I think in a way that makes sense as it's just a Phar file, so it has no knowledge of whether it's installed via Composer, Brew, Phive, or whatever. 🤷🏻 (Unless you do a check like you have). I think, if you are wanting to disable the |
Beta Was this translation helpful? Give feedback.
Regarding your first query, if you leave the dependencies in the
require
section of yourcomposer.json
, they will be installed. This is why it is recommended to move them to therequire-dev
(other than thephp
version requirement). It's also recommended to exclude unnecessary files from your built archive (so that only the Phar is included).You can see an example of this with the Oh Dear CLI:
.gitattributes
excludes all content other thanbuild/ohdear
, and accompanyingLICENSE.md
,README.md
, andcomposer.json
composer.json
defines the PHP requirement for Composer, but the other dependencies are included in-dev
so that they are not included when installing globally through Composer