PHP code example of vikijel / joomla-extensions-packager
1. Go to this page and download the library: Download vikijel/joomla-extensions-packager library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
vikijel / joomla-extensions-packager example snippets
use VikiJel\JoomlaExtensionsPackager\Package;
try
{
$path = Package::create('Something All-In-One')
->addExtension('com_test', '../tests/data/some_file.zip')
->addExtension('mod_test', '../tests/data/some_file.zip', 'module', 'site')
->addExtension('plg_system_test', '../tests/data/some_file.zip', 'plugin', null, 'system')
->pack();
echo 'Path to created package is ' . $path;
//Outputs: Path to created package is: /path/to/repository/out/pkg_something_all_in_one-1.0.0.zip
}
catch (Exception $e)
{
die('Failed to create package, error: ' . $e->getMessage());
}
use VikiJel\JoomlaExtensionsPackager\Package;
use VikiJel\JoomlaExtensionsPackager\Extension;
try
{
$path = Package::create('Something Else All-in-one')
->setAuthor('Your Name', '[email protected]', '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());
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.