Logo Background RSS

PHP_Archive & Phar

  • Written by vinuvinu No Comments Comments
    Last Updated: February 27th, 2007

    Looking for an easy way to package your php application without having to copy tons of files across servers? Here’s a new PHP Extension which allows you to create and use PHAR (PHP Archive) files.

    Here’s how you would use it in your code:

    < ?
    include 'phar:///full/path/to/my.phar/file.php';
    ? >

    Phar provides both a stream wrapper (phar://) and a Phar class which can be used to access the contents of a phar archive. What is a phar archive? Think of it as a virtual filesystem that is customized for use with PHP, sort of like a Java .jar archive.

    .phar files can be read using the phar stream, or with the Phar class. If the SPL extension
    is available, a Phar object can be used as an array to iterate over a phar’s contents
    or to read files directly from the phar.

    Phar archives can be created using the streams API or with the Phar class, if
    the phar.readonly ini variable is set to false.

    Greg’s Blog :Introducing pecl extension phar - Lot 49: Greg Beaver’s blog

    Phar Extension page: http://pecl.php.net/package/phar

    Bookmark and share:
    • del.icio.us
    • Digg
    • StumbleUpon
    • BlinkList
    • blogmarks
    • Furl
    • Slashdot
    • Spurl
    • Technorati
    • YahooMyWeb
    • description
    • Facebook
    • Google
    • Live
    • Ma.gnolia
    • NewsVine
    • Reddit
    • TwitThis

Advertisement

Leave a Comment