- December 25, 2015
- Posted by: Xirgosoft Technologies
- Category: Vtiger Development

Vtiger vtlib provides API to export module as a zip format (package) file which can used for importing through Module Manger.
require_once(‘vtlib/Vtiger/Module.php’);
require_once(‘vtlib/Vtiger/Package.php’);
$package = new Vtiger_Package();
$package->export(‘<MODULE Instance>’, ‘<DESTINATION DIR>’, ‘<ZIPFILE NAME>’, <DIRECT DOWNLOAD>);
<MODULE Instance> Vtiger Module instance to be exported (packaged) module.
<DESTINATION DIR> (Optional: Default=test/vtlib) Directory where the zip file output will be created(stored).
<ZIPFILE NAME> (Optional: Default=modulename-timestamp.zip) Zip file name to use for the output file.
<DIRECT DOWNLOAD> (Optional: Default=false) If true, the zip file created will be streamed for download and zip file will be deleted after that.
Sample Code:
<?php
require_once(‘vtlib/Vtiger/Module.php’);
require_once(‘vtlib/Vtiger/Package.php’);
$package = new Vtiger_Package();
$package->export(Vtiger_Module::getInstance(‘SMSModule’),’test/vtlib’,’SMSModule-Export.zip’,true);
?>