Setting up a Minicli app as Composer bin command¶
If you want to distribute your application with an executable that runs from Composer's bin folder, you can use Minicli as an entry point for that.
In this case, when including the Composer autoload script, you'll need to first check if the application is being called from vendor/bin (as a required dependency) or if it's being called from the application folder itself (as a standalone project).
Update your script to include this check:
|Updating your Minicli to handle path changes|
With your script ready, edit the project's
composer.json file to include
minicli in your
This is an example of a valid
composer.json file from a demo package built that way:
If your project is already on Packagist, then you'll need to commit and push your changes to the remote repository so that they are picked up by Packagist. You may need to create a new release of your project in order to deliver the changes to existing users.
For more information on how to create a Composer bin command with Minicli, check this tutorial on DEV.to.