I’m trying to load the PHPWord library without Composer, directly.
sc_include_library(“prj”, “phpword”, “PhpWord.php”, true, true); // works
$phpWord = new \PhpOffice\PhpWord\PhpWord(); // error: can’t find phpMedia
I’m not sure if I need to load AutoLoader or PHPWord.
It’s strange that it looks in the ‘grp’ directory when I’ve added the external library at the project level
Class “PhpOffice\PhpWord\Media” not found in /opt/NetMake/v9-php81/wwwroot/scriptcase/app/SGAPlus/_lib/libraries/grp/phpword/PhpWord.php
hi Luis
yes, you need autoload if it is present.
when you create a library you have 2 options - for the project or global level - any project
if you choose the project level, you load libraries with “prj” parameter. “sys” is for the global libraries.
(put libraries include in onapplicationinit event)
sc_include_library(“prj”, “import_files”, “vendor/autoload.php”, true, true);
sc_include_library(“sys”, “array2table”, “array2table.php”, true, true);
also mind the namespaces, it seems scriptcase does not support it, you need to call any function using full class path.
example
$inputFileType = \PhpOffice\PhpSpreadsheet\IOFactory::identify($file);
$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader($inputFileType);
succes
Maxim
como tú indicas parace que lo has instalado con composer.
yo al final descargue el la librearia directamente a una librearía externa y registré Autolader.php desde el directorio raiz y veo que me funciona
Gracias