I'm trying to make a simple test integrating fpdf with phalcon, however, I am facing a problem that says that php class is not found:
I have placed fpdf folder in library folder .
/library/fpdf181
In config file libraryDir points to library folder...
'application' => [
'appDir' => APP_PATH . '/',
'controllersDir' => APP_PATH . '/controllers/',
'modelsDir' => APP_PATH . '/models/',
'migrationsDir' => APP_PATH . '/migrations/',
'viewsDir' => APP_PATH . '/views/',
'pluginsDir' => APP_PATH . '/plugins/',
'libraryDir' => APP_PATH . '/library/',
'cacheDir' => BASE_PATH . '/cache/',
In loader I have registered library folder :
$loader->registerDirs(
[
$config->application->controllersDir,
$config->application->modelsDir,
$config->application->libraryDir,
]
)->register();
A simple test view, showpdf.phtml
<?php
error_reporting(E_ALL);
echo 'aaaaa';
$pdf = new FPDF(); // Class FPDF located in /library/fpdf181/fpdf.php file
$pdf->AddPage();
$pdf->SetFont('Arial','B',16);
$pdf->Cell(40,10,' Hello PDF World');
$pdf->Output();
echo 'proba4';
?>
echoed string 'aaaaa' is printed but pdf is not created ...
Console log says :
PHP Fatal error: Uncaught Error: Class 'FPDF' not found in /var/www/html/phonebook/app/views/index/showpdf.phtml:9
What am I doing wrong? please , any help is welcome..
Thanks in advance