Skip to content

vikijel/joomla-extensions-packager

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Joomla! Extensions Packager

PHP Library for generating All-In-One install packages (*.zip) with multiple extensions for Joomla! CMS

Build Status

About

Features

  • Packs given extensions, languages, scriptfile etc. together with auto-generated install xml manifest into a ZIP archive ready for installation into Joomla! CMS
  • Created install packages are:
    • Compatible with Joomla! 2.5 and newer (Xml manifest has <extension> root element)
    • Native extension installation packages of type 'package'

Requirements

Installation via Composer

Run this command inside your project directory (Your project dir is later referred to as repository):

composer require vikijel/joomla-extensions-packager

You need to have Composer installed for above command to work

Inclusion to project

  • If you are using Composer in your project, the vendor/autoload.php should be already required in your project
  • repository = your project directory (where you ran composer require)
require_once '/path/to/repository/vendor/autoload.php'; 

Usage - Basic

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());
}

Usage - Advanced

use VikiJel\JoomlaExtensionsPackager\Package;
use VikiJel\JoomlaExtensionsPackager\Extension;

try
{
	$path = Package::create('Something Else All-in-one')
	               ->setAuthor('Your Name', 'your.email@example.com', '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());
}

This library is not affiliated with or endorsed by the Joomla! Project or Open Source Matters. The Joomla!® name and logo is used under a limited license granted by Open Source Matters, the trademark holder in the United States and other countries.

About

Library for generating all-in-one install packages with multiple Joomla! extensions

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages