Framework Structure - Vendors
Vendors are the third-party libraries that integrated to further extend ApPHP Framework's functionalities.
This is a framework-level vendor sub-directory and it contains all third-party modules or libraries
which your application may need. The libraries and modules that placed in the vendor sub-directory
are not modified from their original, distributed state. As a developer you may use framework-level
vendors for your purposes, although it's generally intended for internal use of the framework
helpers.
Of course, you may create an application-level vendor sub-directory, that will be used for your application
purposes only. In this case you may create a a sub-folder called vendors and place it
in protected directory of your application. Find more information about application
vendors here.
Currently there are following framework-level vendors:
-
framework/ framework directory
-
vendors/ directory where placed all vendors
- ci CI_Security (Security Class from CodeIgniter framework)
- dbug PHP version of ColdFusion's cfdump
- mobiledetect PHP Mobile Detect Library
- phpmailer PHP mailer files
- nusoap Web Services Toolkit for PHP
- opauth Multi-provider authentication framework for PHP
- tcpdf TCPDF generating PDF documents and barcodes
An example for using of dbug see here.
Below you may see an example that illustrates how CMailer helper uses the phpmailer
vendor code from the ApPHP framework:
public static function send($to, $subject, $message, $params = '')
{
if(!strcasecmp(self::$_mailer, 'smtpMailer')){
return self::smtpMailer($to, $subject, $message, $params);
}else if(!strcasecmp(self::$_mailer, 'phpMailer')){
return self::phpMailer($to, $subject, $message, $params);
}else{
return self::phpMail($to, $subject, $message, $params);
}
}
Here an example that demonstrates how CPdf helper uses the TCPDF
vendor code from the ApPHP framework:
/**
* Download listing PDF
* @param int $id
*/
public function downloadPdfAction($id = 0)
{
$content = 'here must be HTML code for the PDF document...';
CPdf::config(array(
'page_orientation' => 'P', // [P=portrait, L=landscape]
'unit' => 'mm', // [pt=point, mm=millimeter, cm=centimeter, in=inch]
'page_format' => 'A4',
'unicode' => true,
'encoding' => 'UTF-8',
'creator' => 'AutoPortal',
'author' => 'ApPHP',
'title' => 'Listing #'.$id,
'subject' => 'Listing #'.$id,
'keywords' => '',
//'header_logo' => '../../../templates/reports/images/logo.png',
'header_logo_width' => '45',
'header_title' => 'Listing #'.$id,
'header_enable' => false,
'text_shadow' => false,
'margin_top' => '5',
'margin_left' => '5'
));
CPdf::createDocument($content, 'Listing #'.$id, 'D'); // 'I' - inline , 'D' - download
}
Click to find more information about vendors for applications.