-->

How to Install PHPSpreadsheet in Joomla

2019-08-16 04:03发布

问题:

I'm wondering how to best incorporate PHPSpreadsheet into Joomla! applications, on shared hosting.

With PHPExcel, you just uploaded the library.

PHPSpreadsheet is using Composer, which is new to me, but looks straightforward enough. However, I see Joomla! includes it to manage dependencies in the core, but does not publish the composer.json file, and commits the /vendor subfolder.

Any advice on the best way to safely add PHPSpreadsheet so its available to Joomla! extensions, without messing up Joomla! core?

回答1:

You can just add a normal composer.json file in Joomla's root folder. Composer will then create a vendor folder on the main level, and leave the libraries/vendor folder unchanged for the Joomla core.

Any extension that wants to use libraries from the root vendor folder must take care of loading the corresponding vendor/autoload.php by itself.



回答2:

use

JLoader::registerNamespace('PhpOffice', $pathToPhpOffice);


回答3:

Similar lines to the above.... But how do you get PHPSpreadsheet installed on my hosted website, where I have limited access to the back end.

I can FTP to the root of the site.