Views : 2147  |
PHK stands for PHp pacKage. It is a package/archive system for
PHP. Unlike most formats, used only for software distribution and deployment, a PHK
application runs directly from its package file, without any file extraction, providing a
PHP-oriented equivalent of Java's jar features.
But PHK goes much further than a raw jar-like package builder, providing
application maintainers with a set of high-level features, making it
easy to switch an existing application to PHK.
Here are the main features of the PHK package system, focusing on the
benefits it can bring to your projects :
- No more install procedure : Installing a PHK package is just
transferring the package file to its final location, optionally renaming it
with a suffix corresponding to the user's environment, and that's all ! No
shell access required, no chown, chgrp, chmod, gunzip, recursive ftp...
Every developer involved in software support knows how valuable it can be to
suppress all these basic but time-consuming installation problems !
- Easier software management : As your software remains in a
single file, it becomes much easier to manage, copy, move, remove, or
upgrade.
- No runtime needed : users don't have to install anything before using a PHK archive, as the archive contains its runtime code. Any PHP interpreter (version 5.1 or more) is ready to
include/execute a PHK archive without any modification.
- Data integrity : Every time the package is loaded, its size
is checked, allowing to detect typical ascii/binary FTP transfer
corruptions. On user's request, the package runs a CRC auto-check. Please
note that this feature is not equivalent to digital signatures, as it
protects against unintentional modifications only.
- Fast runtime : The PHK and Automap extensions are available
from the PECL repository. With these extensions installed, PHK packages run
almost as fast as the original 'unpackaged' software. We don't have benchmarks
for this 'almost' value yet, but the results observed so far are very
promising. Our goal, here, is to make PHK packages always faster than their
'unpackaged' equivalent.
- Supports libraries, applications, plugins : a PHK archive can contain a
library or an application (an application is a library with an entry point).
PHK also provides some specific features to design a plugin architecture.
- Integrated Autoloader : PHK embeds an advanced autoloader,
named Automap.
At package creation time, the PHP scripts are analyzed and the
class/interface names are registered in a lookup table. At runtime, the
scripts are automagically included when needed. This
mechanism is fully transparent and automatic. Using this mechanism, you
can remove every include/require directives from you OO software and forget 'undefined class' errors.
- Unlimited number of subfiles in an archive : a PHK package can contain an
unlimited number of subfiles and directories. A subfile can contain up to 2
Gbytes of binary data. Every subfile can be, on a file by file basis, compressed (gzip or bz2),
and/or filtered through php_strip_whitespace() (making PHP scripts smaller and
faster).
- Webinfo introspection : the webinfo mode is a built-in
introspection tool. In webinfo mode, the archive file behaves like a
small web site, displaying information about the archive. PHK provides standard locations for information like
package's name, author, license, copyright, etc. It also
allows to specify an icon and a reference URL.
- Built-in CLI commands : several built-in CLI commands are available. These commands are
the equivalent, in CLI mode, of the webinfo mode. They allow to display
every information about the PHK archive's structure and content.
- Meta-packages : PHK supports the concept of meta-packages, allowing a PHK archive to be incorporated as a subfile inside another
PHK archive,
along with other regular files. This feature is useful in advanced cases, as
when integrating unit tests in the archive (see the
Zend Framework demonstration packages for an example), or to build
meta-libraries (incorporating several librairies, but without merging them).
- Enforces extension dependency : Through options you set at
build time, each time the package is loaded, it will ensure that its required extensions are present.
If one of the package's
required extensions is missing and cannot be dynamically loaded, the
execution aborts with a meaningful error message. And the user gets this
message the first time it runs the package, not two months later via a
cryptic error message...
- Web path protection : When accessing a PHK archive directly
through a web server, the subfiles are automatically protected from incorrect or unauthorized
access. The legitimate entry points are explicitely identified,
making your software easier to secure.
- Digital signatures : This feature, available soon, will
allow to digitally sign the packages you distribute (using a digital
certificate). This will help your users trust
the package they receive.
For more reasons to use PHK, you may also read some user
stories.
We hope you'll have as much fun using PHK as we have developing it !
Last update : Saturday, 19 January 2008
|
|
|