如何在没有安装的情况下使用PhpSpreadsheet(如PHPExcel)

如何在没有安装的情况下使用PhpSpreadsheet(如PHPExcel)

问题描述:

According to the PhpSpreadsheet Doc it's neccessary to install it with composer. In my case I just have a webspace without Terminal but Plesk. Is it anyway possible to use PhpSpreadsheet, like it is with PHPExcel where you just have to place the files in any location? What do I have to do to get it run? I found no further information how to with only FTP webserver access.

根据 PhpSpreadsheet Doc 需要用composer安装它。 在我的情况下,我只有一个没有终端但没有Plesk的网站空间。 无论如何都可以使用PhpSpreadsheet,就像使用 PHPExcel 一样 只需将文件放在任何位置? 我需要做什么才能让它运行? 我没有找到如何仅使用FTP网络服务器访问的更多信息。 p> div>

In your case there are two options for you!

Answer: 1

Alternative method without terminal

Run composer with a PHP script in browser

Answer: 2

Third party sites, which allow to download composer packages online. get PHPspreadsheet latest version.

https://php-download.com/package/phpoffice/phpspreadsheet

Bonus You can download almost any composer packages @ https://php-download.com

Have you considered installing composer locally, running it as instructed, and then just sending the generated files to the server via normal FTP? You install composer on your computer and run it there, then upload via FTP/SFP...

Composer is not "necessarily" intended to run live while the user is downloading the pages, it is intended to be run "mainly" on your local computer and generating the files and dependencies that later on you upload to the server. It can update the files on your server, but that is a convenience not a necessity.

Smartpal, thanks for your pack, it works fine!

Also it possible to replace folder:

/phpspreadsheet/vendor/phpoffice/phpspreadsheet/src/

in Smartpal's archive with more fresh sources from phpspreadsheet github and it also will work.

PS: If you have issues with reading xls files saved in encoding other than CP1252, you have to seek literals CP1252 in file ./src/PhpSpreadsheet/Reader/Xls.php and replace them with other value that you need or some named constant or even mb_detect_encoding(). Then it will read such xls correctly.

By registering custom autoloader and PSR simplecache autoloader it is possible to fully workaround composer installation - see:

https://github.com/PHPOffice/PhpSpreadsheet/issues/31#issuecomment-354502740

Please note, that installation via composer is currently the only officially supported solution.