Ask HN: Is there a simple installer file for PHP software?

2 points by EGreg ↗ HN
If there is nothing like this, I'll probably write and release it for our software, but it could work for any software.

The background to this is that PHP powers 80% of web sites, and there is a huge number of commodity hosting solutions out there.

Basically, this would be a single PHP file that people would download and install on their favorite commodity host. Upon launch, it would

1. Look at some hardcoded index of https URLs

2. Download a zip file and check the signed hash

3. If the signatures check out (There would be a minimum # of signatures required) then unzip it

4. Change the file permissions and run installer

It would have a Web interface and a CLI interface.

I just haven't seen anything that's a single PHP file download. It seems like the easiest distribution model for commodity hosts which regular joes use.

5 comments

[ 3.4 ms ] story [ 26.5 ms ] thread
You've described the setup instructions for Composer. Which once Composer is installed, it can be used to install packages globally.

https://getcomposer.org/download/

Composer isn't one file, and doesn't use zip format, or signed hashes as far as I know. The sources could be compromised, for instance. And it couldn't be 'simply installed' by an average joe
* Composer is one file. It's a .phar (as described by @az09mugen)

* I think in typical use, Composer is installing via Packagist.org, which is typically pointed at a GitHub repo, and it is the repo's zip file that is downloaded to your computer. You can look in composer.lock and see `"type": "zip"` throughout

* It definitely has some sort of hash verification in the PostFileDownloadEvent class. I've never used it to know if it would satisfy your need

Similarly, WP CLI is a .phar file which can then install additional packages. It's really just using Composer under the hood.

(comment deleted)
I don't think it fits exactly your requirements (for the GUI part), but the closest thing I know is the .phar files, for PHp ARchive. This basically bundles a whole project into a single file. It is used by composer also as written by BrianHenryIE. You can download the .phar file, drop it into your computer and run it with the command :

php file.phar

More info : https://www.php.net/manual/en/phar.using.intro.php