Upgrade to Pro — share decks privately, control downloads, hide ads and more …

PHAR, the PHP .exe format

PHAR, the PHP .exe format

Learn about what the PHAR (PHP Archives) format is all about. A PHAR is conceptually similar to a Java JAR but made to fit PHP’s needs.

Hear how to use it to distribute your product to clients, why open source projects have started offering their projects as a PHAR file, run your application directly from the PHAR container without extracting anything to the filesystem, secure it using the signature feature to ensure the container hasn’t been tampered with and many other interesting features.

By the end of it you will be wanting to use PHAR for CLI and Web apps alike!

Helgi Þorbjörnsson

May 21, 2012
Tweet

More Decks by Helgi Þorbjörnsson

Other Decks in Programming

Transcript

  1. PEAR: PHP_Archive ‣ Reference implementation ‣ User Land Code ‣

    Less Powerful ‣ Works on older PHP ‣ Not maintained anymore
  2. Get all the code used in this talk and more!

    https://github.com/helgi/phar-talk
  3. Streams Usage fopen / fwrite / fclose file_get_contents opendir /

    rmdir / mkdir anything that works with streams
  4. Pros Single download with all dependencies Run multiple versions in

    parallel Upgrades are easy No unpacking Security against modifications
  5. Cons Incremental updates (no deltas) Upgrading is a manual process

    Web server may need changes Extending the application is harder README / INSTALL become hard to reach
  6. PharData Phar archives can be extracted to disk Can operate

    on non-phar gzip and tar extract and compress archives Like PDO for archives! :-)