interface ArchiverInterface

Same name and namespace in other branches
  1. 11.x core/lib/Drupal/Core/Archiver/ArchiverInterface.php \Drupal\Core\Archiver\ArchiverInterface
  2. 10 core/lib/Drupal/Core/Archiver/ArchiverInterface.php \Drupal\Core\Archiver\ArchiverInterface
  3. 9 core/lib/Drupal/Core/Archiver/ArchiverInterface.php \Drupal\Core\Archiver\ArchiverInterface
  4. 8.9.x core/lib/Drupal/Core/Archiver/ArchiverInterface.php \Drupal\Core\Archiver\ArchiverInterface
  5. 7.x includes/archiver.inc \ArchiverInterface

Defines the common interface for all Archiver classes.

Hierarchy

Expanded class hierarchy of ArchiverInterface

All classes that implement ArchiverInterface

Deprecated

in drupal:11.3.0 and is removed from drupal:12.0.0. There is no replacement.

See also

https://www.drupal.org/node/3556927

\Drupal\Core\Archiver\ArchiverManager

\Drupal\Core\Archiver\Attribute\Archiver

Plugin API

File

core/lib/Drupal/Core/Archiver/ArchiverInterface.php, line 18

Namespace

Drupal\Core\Archiver
View source
interface ArchiverInterface {
  
  /**
   * Adds the specified file or directory to the archive.
   *
   * @param string $file_path
   *   The full system path of the file or directory to add. Only local files
   *   and directories are supported.
   *
   * @return $this
   *   The called object.
   */
  public function add($file_path);
  
  /**
   * Removes the specified file from the archive.
   *
   * @param string $path
   *   The file name relative to the root of the archive to remove.
   *
   * @return $this
   *   The called object.
   */
  public function remove($path);
  
  /**
   * Extracts multiple files in the archive to the specified path.
   *
   * @param string $path
   *   A full system path of the directory to which to extract files.
   * @param array $files
   *   Optionally specify a list of files to be extracted. Files are
   *   relative to the root of the archive. If not specified, all files
   *   in the archive will be extracted.
   *
   * @return $this
   *   The called object.
   */
  public function extract($path, array $files = []);
  
  /**
   * Lists all files in the archive.
   *
   * @return array
   *   An array of file names relative to the root of the archive.
   */
  public function listContents();

}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.