Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

distributing a php command line tool

Tags:

shell

php

I have a php command line tool that I would like to share with the world. Well, actually I plan to write it, and it is a tool for loading design documents into couchdb, but that's not really the point.

Anyway, is there a best practice for packaging php scripts so that they can be distributed for easy installation? I'm thinking something along the lines of the good old "./configure & make & make install", but what to do for a php script? I have read about phar, but it seems that it is intended mainly for libraries. So any ideas? Or examples of how other projects have done this?

like image 796
Mikael Lindqvist Avatar asked Feb 18 '13 10:02

Mikael Lindqvist


People also ask

Can we use PHP for command line applications?

PHP is well known for its popularity with web applications and CMSs, but what many people don't know is that PHP is also a great language for building command line applications that don't require a web server.

What is PHP CLI command?

PHP's Command Line Interface (CLI) allows you to execute PHP scripts when logged in to your server through SSH. ServerPilot installs multiple versions of PHP on your server so there are multiple PHP executables available to run.


1 Answers

Composer is a good example of how to package up the tool, both as a stand-alone set of source code, and code that can be run. I installed it as a phar and now can just run it anywhere as 'composer --options args'

like image 161
Alister Bulman Avatar answered Sep 30 '22 16:09

Alister Bulman