public function testBuildsPackageBasic()
 {
     $this->path = Package::create($this->getUniqueName())->addExtension('com_test', static::$archive_src)->addExtension('mod_test', static::$archive_src, 'module', 'site')->addExtensionInstance(Extension::create('plg_system_test', static::$archive_src)->setType('plugin')->setGroup('system'))->addExtension('tpl_test', static::$archive_src, 'template', 'admin')->addExtension('lib_test', static::$archive_src, 'library')->addExtension('lng_test', static::$archive_src, 'language', 'site')->addExtensionInstance(Extension::create('file_test', static::$archive_src, 'file'))->pack();
     self::assertFileExists($this->path);
 }
 /**
  * @param string $name   System name of extension
  * @param string $file   Path to extension's install package
  * @param string $type   Type of extension (component/module/plugin/language/file/library/template)
  * @param string $client Client (site/admin) - only some extension types such as modules, templates and language packs
  * @param string $group  Plugin group (system/content/search/authentication/...) - plugins only
  *
  * @return Package
  * @throws \Exception
  */
 public function addExtension($name, $file, $type = 'component', $client = null, $group = null)
 {
     return $this->addExtensionInstance(Extension::create($name, $file, $type, $client, $group));
 }
<?php

/**
 * Usage of JoomlaExtensionsPackager library - Advanced Example
 *
 * @author: Viktor Jelínek (VikiJel)
 */
require_once __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php';
use VikiJel\JoomlaExtensionsPackager\Package;
use VikiJel\JoomlaExtensionsPackager\Extension;
try {
    $path = Package::create('Something Else All-in-one')->setAuthor('Your Name', '*****@*****.**', 'http://your.domain.example.com')->setVersion('1.2.3')->setDescription('This is something else...')->setLicense('GPL')->setCreationDate('2016-05-21')->setMinJoomlaVersion('2.5')->setUrl('http://url.com')->setScriptfile('../tests/data/some_file.php')->addExtension('com_test', '../tests/data/some_file.zip')->addExtension('mod_test', '../tests/data/some_file.zip', 'module', 'site')->addExtensionInstance(Extension::create('plg_system_test', '../tests/data/some_file.zip')->setType('plugin')->setGroup('system'))->addExtension('tpl_test', '../tests/data/some_file.zip', 'template', 'admin')->addExtension('lib_test', '../tests/data/some_file.zip', 'library')->addExtension('lng_test', '../tests/data/some_file.zip', 'language', 'site')->addExtensionInstance(Extension::create('file_test', '../tests/data/some_file.zip', 'file'))->addLanguage('../tests/data/some_file.ini', 'cs-CZ')->addUpdateServer('http://updates1.example.com', 'My update server 1')->addUpdateServer('http://updates2.example.com', 'My update server 2', 'collection', 2)->pack('../out/custom', 'pkg_overridden_name.zip');
    echo 'Path to created package is ' . $path;
    //Outputs: Path to created package is /path/to/repository/out/custom/pkg_overridden_name.zip
} catch (Exception $e) {
    die('Failed to create package, error: ' . $e->getMessage());
}