JAR files for PHP-GTK?
| From: | Ciprian Popovici | Date: | Sun, 23 May 2004 21:06:32 +0000 |
| Subject: | JAR files for PHP-GTK? | ||
| Groups: | php.gtk.general | ||
| Request: | Send a blank email to php-gtk-general+get-4562@lists.php.net to get a copy of this message | ||
I'm not sure if the issue of JAR files for PHP-GTK has been discussed before,
but then again I've monitored the list for only a few months now and my
interest in PHP-GTK is recent.
By "JAR files" I mean basically a .zip archive, with a specific extension,
organized after certain rules, which contains a PHP-GTK project. The idea in
itself is nothing new; there is already WinAmp .wsz, Java .jar, Mozilla .xpi
and so on.
Such a package would be useful, IMHO, because with PHP-GTK we often find the
need for more than one file involved in a project: images, glade definitions,
code and perhaps more. Bundling all such files in a single archive is very
easy to do. The alternative is to take into consideration the filesystem
structure of the particular operating system the project is installed on, and
down that path lays the use of autotools and all kinds of additional
complications. Not exactly what PHP-GTK needs, if it aims to become a widely
accepted cross-platform language. Java has probably already proven all these
points with .jar.
While PHP-GTK would especially benefit from this, I suspect it would be
useful for all CLI PHP projects. I'm not so sure about the Web, since I
suppose it may introduce all kinds of security and performance issues.
Besides, you can say that Web projects already run in "containers", so to
speak, with DOCUMENT_ROOT and all that.
A simple minimal rule to be followed by the PHP archives would be to contain
an index.php file in the root of the archive. The author would be free to
organize the rest of the archive as he sees fit. I don't see the need to
impose additional rules for now.
The CLI php executable could include an option to execute such archives. It
would implicate unpacking the archive, defining a constant such as
CONTAINER_ROOT pointing at the unpacked directory, execute index.php, and
clean everything up after index.php stops.
Given these issues, I suspect that this idea should be taken up with the
developers of PHP itself, if it hasn't been proposed before. I've chosen to
discuss it here first because it is in CLI projects, and particularly in
PHP-GTK projects, that the need for such archives is truly big.
FWIW, the idea of archives can be trivial to implement. I've already written
a php script which implements archive support in the following manner: `php
load_archive.php myproject.zip`. If anyone wants to see it I'll send it to
the list, but be warned that it's really simplistic (uses unzip to test and
unpack the archive and is Linux-centric).
What do you people think? Is this idea already known? Are there related
projects? If yes, where can I find discussions regarding it and can you tell
me how far has it gone? If no, where do you suggest I take this next?
--
Ciprian Popovici