![]() |
Setting up FPDI_Protection in CI 4 [namespace giving me a challenge] - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28) +--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30) +--- Thread: Setting up FPDI_Protection in CI 4 [namespace giving me a challenge] (/showthread.php?tid=72961) |
Setting up FPDI_Protection in CI 4 [namespace giving me a challenge] - tebogosebake - 03-05-2019 I am trying to generate a pdf( using FPDI_Protection) in CI 4 but i keep getting this error "Class 'FPDF' not found #0 [internal function]: CodeIgniter\Debug\Exceptions->shutdownHandler() #1 {main}" Quote:In my client controller i have Code: namespace App\Controllers; Quote:FPDI_Protection.php file link here PHP Code: namespace App\Libraries\pdf; //I included this namespace Quote:fpdi.php file PHP Code: <?php Quote:fpdf.php file PHP Code: <?php Error when generating the pdf file is as follows: "Class 'FPDF' not found #0 [internal function]: CodeIgniter\Debug\Exceptions->shutdownHandler() #1 {main}" RE: Setting up FPDI_Protection in CI 4 [namespace giving me a challenge] - puschie - 03-06-2019 you need to add the library path to autoload config and your classes to the classmap : https://codeigniter4.github.io/CodeIgniter4/concepts/autoloader.html your should psr4 looks like this: PHP Code: $psr4 = [ and your classmap like this: PHP Code: $classmap = [ not sure if you need both^^ but you should add your main class to the classmap, that is accessed from outside the pdf directory ( library ) |