Results 1 to 6 of 6

Thread: How to Create Phar Archives in PHP?

  1. #1
    Join Date
    May 2009
    Posts
    258

    How to Create Phar Archives in PHP?

    Hello everyone,
    I need more help from you guys. Since I am not expert in PHP programming language, I am facing number of doubts. So thought to post here, since you guys explain very well.!! Now I want some information about the Phar Archive. Please explain me how to Create Phar Archives in PHP? Any other information related to the topic would be grateful.!!

  2. #2
    Join Date
    Aug 2006
    Posts
    235

    Re: How to Create Phar Archives in PHP?

    Phar archives are similar in concept to Java JAR archives, but are designed specifically for the needs and the flexibility of PHP applications. A Phar archive is used to distribute a complete PHP application or library as a single file. Unlike Java, no external tool is required to handle or run a PHP Phar archive. An application form Phar archive is used exactly the same way as any other PHP application :
    PHP Code:
    php applicationsympa.phar 
    3.2 (northwood)
    2gig ram
    ATI AIW X800xt 256mb
    Gigabyte GA-8knxp 875p Chipset
    Optiwrite 8X DVD Burner
    Win XP PRO Sp2 (Works Perfectly)
    2 SATA Raptor 74gig Raid 0
    2 7200 IDE 320gig HD

  3. #3
    Join Date
    Aug 2006
    Posts
    227

    Re: How to Create Phar Archives in PHP?

    The phar stream wrapper provides the core of the phar extension. The phar stream wrapper allows access to files within a phar archive using the standard file functions fopen (), opendir (), and any other operating on regular files. The phar stream wrapper supports all operations of reading / writing to both managed al the files and directories. The class Phar implements advanced functionality for accessing files and creating phar archives. Since version 2.0.0, class Phar also provides three static methods, Phar:: webPhar (), Phar:: mungServer () and Phar:: interceptFileFuncs () that are critical to package PHP applications to be used on a conventional file system or as an application site.
    I do to dead flowers what people at morgues do to dead people. Suck all the moisture out, dip them in plastic, paint them up pretty and put them in a nice frame.

  4. #4
    Join Date
    Mar 2008
    Posts
    672

    Re: How to Create Phar Archives in PHP?

    The class Phar supports reading and manipulation of Phar archives, as well as iteration through the functionality inherited from class RecursiveDirectoryIterator. With the support of the interface ArrayAccess, the files contained within a Phar archive can be accessed as if they were members of an associative array. The class PharData class extends Phar, and allows the creation and modification of tarballs and zip files non-executable (data) even if phar.readonly = 1 in php.ini. It is important to note that when a Phar archive is created, the full path must be passed to the constructor of the object Phar. A relative path would prevent initialization.

  5. #5
    Join Date
    Jul 2006
    Posts
    442

    Re: How to Create Phar Archives in PHP?

    All Phar archives contain the following three to four sections :
    1. A container
    2. A manifest describing the contents
    3. The contents of the file
    4. A signature (optional) to check the integrity (only with the phar file format)
    Phar A container is a simple PHP file. The minimum container contains :
    PHP Code:
    <?php __HALT_COMPILER();
    A container must contain at least the token __HALT_COMPILER (); in conclusion. Typically, a container features include load following :
    PHP Code:
    <?php 
    Phar 
    :: mapPhar (); 
    include 
    'phar://demophar.phar/index.php' 
    __HALT_COMPILER();
    "When they give you ruled paper, write the other way..." J.R.J.

  6. #6
    Join Date
    Jul 2006
    Posts
    286

    Re: How to Create Phar Archives in PHP?

    In a phar archive based on tar or zip, the container is stored in the file .phar / stub.php. The default container Phar archive based on phar contains approximately 7kb of code to extract the contents of pharmaceutical and run it. Or sometimes the phar is stored in the case of phar-based archive tar or zip file in .phar / alias.txt as plain text. PHP can not directly access the contents of a Phar archive without the Phar extension is installed if it uses a container that extracts the contents of the phar archive. The container created by Phar:: createDefaultStub () extracts the phar archive and execute its contents from a temporary directory if no phar extension is found.
    IF you hate me, please don't mention it. I know who hates me and who doesn't. You really do not have to make fun of people....

Similar Threads

  1. What is the Phar manifest file entry in PHP?
    By Emily123 in forum Software Development
    Replies: 5
    Last Post: 04-03-2010, 05:53 AM
  2. Why we use PHAR in PHP?
    By NIcaBoy in forum Software Development
    Replies: 5
    Last Post: 04-03-2010, 05:13 AM
  3. Wordpress SEO archives plugin
    By Odalis in forum Windows Software
    Replies: 3
    Last Post: 30-07-2009, 05:51 PM
  4. Create self extracting archives in Windows XP
    By TheGreatOne in forum Tips & Tweaks
    Replies: 1
    Last Post: 14-11-2008, 06:53 PM
  5. Can not Open Archives
    By nonose in forum Technology & Internet
    Replies: 7
    Last Post: 29-09-2008, 08:35 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,714,224,085.08814 seconds with 17 queries