Search Results

  1. Return Values ¶ Phar::buildFromDirectory () returns an associative array mapping internal path of file to the full path of the file on the filesystem, or false on failure.

  2. May 9, 2021 · PHP PharData: build .tar archive from directory, with exclusions Ask Question Asked 4 years, 10 months ago Modified 4 years, 10 months ago

  3. Mar 12, 2026 · Populate a tar/zip archive from directory contents. The optional second parameter is a regular expression (pcre) that is used to exclude files. Any filename that matches the regular expression will be included, all others will be excluded. For more fine-grained control, use PharData::buildFromIterator ().

  4. Errors/Exceptions This method throws BadMethodCallException when unable to instantiate the internal directory iterators, or a PharException if there were errors saving the phar archive.

  5. See Also Phar::buildFromDirectory () - Construct a phar archive from the files within a directory. PharData::buildFromIterator () - Construct a tar or zip archive from an iterator.

  6. Simple usage example of `PharData::buildFromDirectory ()`. PharData::buildFromDirectory is a PHP function that allows you to create a compressed tar or zip archive from the files contained within a specified directory. It automates the process of recursively adding files and directories, preserving their structure, and compressing them into a single archive file. This function simplifies the ...

  7. The PharData class provides a high-level interface to accessing and creating non-executable tar and zip archives. Because these archives do not contain a stub and cannot be executed by the phar extension, it is possible to create and manipulate regular zip and tar files using the PharData class even if phar.readonly php.ini setting is 1.