Build your next Console Application Easily!.


Console applications like Composer is very convienient to use because all of its dependencies is packaged inside a phar file. You can easily move around the phar file or even remove the filename extension at all, making it looks like a single executable file. Creating PHAR files before though is never easy, and this boilerplate gives you a basic structure and tools to build one.

Features

Try the Sample PHAR file

To give you a better idea of what you can produce out of this boilerplate, you can try a simple "Hello World" phar file that you can install in your local machine. All you need is PHP installed to run the sample file.


wget http://www.darwinbiler.com/console-app/sample/yourapp.phar
sudo mv yourapp.phar  /usr/local/bin/yourapp
chmod +x /usr/local/bin/yourapp
yourapp -V

Get Started

Create a new project
composer create-project buonzz/console-app
Fetch the composer dependencies
composer install
In able to generate the a phar file, you need to install the box command. Follow the following instructions to install it

  
curl -LSs https://box-project.github.io/box2/installer.php | php
sudo mv box.phar /usr/local/bin/box
sudo chmod 755 /usr/local/bin/box
box --version    
  
  

In your php.ini file, make sure you have set phar.readonly settings to Off
Now you are all set!
Just execute
./build.sh
and it will produce the phar file in dist folder.