Simple boilerplate for build your command line tool.
- PHP 5.4+
composer create-project jaceju/clitool-boilerplate myapp -s dev
Change the constants below in src/App/Application.php
:
const NAME = 'App';
const BIN_NAME = 'app';
const REPOSITORY = 'vendor-name/app-repository';
Rename output phar in box.json
:
"output": "bin/app.phar",
Finally, change the name
, description
, authors
and scripts
in composer.json
.
Here is a example of README.md
below for authors of the package. I suppose package name is app
in this example.
You can remove all description above and this line.
- PHP 5.4+
Add ~/.composer/vendor/bin/
to PATH
environment variable first. Then can install the package by:
composer global require vendor-name/app-repository
And app
command should be executable.
You can build the phar file by:
composer build
Update app
to latest version:
app self-update
You can create an auto-completion of app
for zsh by:
app zsh --bind app > ~/.zsh/app
Then add the line below to your .zshrc
file:
source ~/.zsh/app
Same steps as above in bash auto-completion.
MIT