We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

How to setup phpexcel in namespace

Hi all Directories phpexcel in app/library/PHPExcel, and file loader.php contain $loader = new \Phalcon\Loader();

/**

  • We're a registering a set of directories taken from the configuration file */ $loader->registerNamespaces(array( 'Eduapps\Models' => $config->application->modelsDir, 'Eduapps\Controllers' => $config->application->controllersDir, 'Eduapps\Forms' => $config->application->formsDir, 'Eduapps' => $config->application->libraryDir ));

$loader->register(); and in files PHPExcel.php <?php namespace Eduapps\PHPExcel; but run public function excelAction() { $excel = new PHPExcel(); Fatal error: Class 'Eduapps\PHPExcel\PHPExcel_Calculation' not found in /home/opensue/www/eduapps/app/library/PHPExcel/PHPExcel.php on line 124 and tries namespace Eduapps\PHPExcel in file Calculation.php has not been

Just register the directory.

Example

$loader->registerDirs( array( $config->application->libraryDir."PHPExcel/" ) );

$loader->register();

$excel = new PHPExcel();

...



58.4k

Thank Douglas Bezerra Possas but i use $loader->registerNamespaces, and i slove problem above

Can you explain how to solve this problem?

Hello. This link is the solution.

https://stackoverflow.com/questions/19303339/create-excel-file-in-phalcon-php-framework

Can you explain how to solve this problem?

— Reply to this email directly or view the complete thread on Phosphorum https://forum.phalcon.io/discussion/1025/how-to-setup-phpexcel-in-namespace#C15531. Change your e-mail preferences here https://forum.phalcon.io/settings

-- Douglas Bezerra Possas