Jeśli jesteś właścicielem tej strony, możesz wyłączyć reklamę poniżej zmieniając pakiet na PRO lub VIP w panelu naszego hostingu już od 4zł!

DZone.com: Phar: PHP libraries included with a single file

DZone.com: Phar: PHP libraries included with a single file

On DZone.com today Giorgio Sironi has a new post looking at an interesting, if seldom used, feature of recent PHP releases – packaging applications with phar archives.

Phar is a php extensions that provides the means for distributing code as a single archive, that does not have to be extracted to a folder before usage. The concept is similar to JVM Jars: each archive becomes a virtual directory where files can be accessed. However, the virtual folder is not limited to class loading, but you can open and read internal files as if it were decompresse into a directory.

He includes a brief “hello world” example of packaging up a script into a phar archive and executing it via PHP. He also shows how easy it is to create an archive from current code, making an archive containing the latest Doctrine 2 release for simple inclusion. Phars also allow compression and hashing but has issues with resource management and access external files.

Source: http://www.phpdeveloper.org/news/16900

<!–
var d = new Date();
r = escape(d.getTime()*Math.random());
document.writeln('’);
//–>

Posted Wrzesień 26th, 2011 in WEB and PHP Development.

Leave a response: