Package ExportΒΆ

vtlib provides API to export module as a zip (package) file which can used for importing through Module Manger.

require_once('vtlib/Vtiger/Package.php');
require_once('vtlib/Vtiger/Module.php');
$package = new Vtiger_Package();
$package->export('<MODULE Instance>', '<DESTINATION DIR>', '<ZIPFILE NAME>', <DIRECT DOWNLOAD>);

<MODULE Instance>

Vtiger_Module instance to be exported (packaged)

<DESTINATION DIR>

(Optional: Default=test/vtlib) Directory where the zipfile output should be created.

<ZIPFILE NAME>

(Optional: Default=modulename-timestamp.zip) Zipfile name to use for the output file.

<DIRECT DOWNLOAD>

(Optional: Default=false) If true, the zipfile created will be streamed for download and zipfile will be deleted after that.

Example

require_once('vtlib/Vtiger/Package.php');
require_once('vtlib/Vtiger/Module.php');
$package = new Vtiger_Package();
$package->export(
      Vtiger_Module::getInstance('Payslip'),
      'test/vtlib',
      'Payslip-Export.zip',
      true
);

Note

Please make sure test/vtlib directory exists under vtigercrm root directory and is writeable.