I have used Composer to install phpoffice/phpspreadsheet. It was installed in a base 'vendor' directory. However where I am needing to use it is in a subdomain directory. I manually moved it to a different 'vendor' directory.
a bit deeper ../public_html/subdomains/newsite/vendor/
I am calling the code from a file a bit yet deeper ../backend/web/xlsx.php
My actual code is as follows:
<?php
use PhpOffice\PhpSpreadsheet\Spreadsheet;
use PhpOffice\PhpSpreadsheet\Writer\Xlsx;
require '../../vendor/autoload.php';
$spreadsheet = new Spreadsheet();
?>
With just this simple set I am getting the following fatal error:
Class 'PhpOffice\PhpSpreadsheet\Spreadsheet' not found
I am still learning a bit about namespaces and composer and I may have missed something when I moved the files manually.
Any help would be greatly appreciated.
Thank You!
I know it's been a long time since you asked, but it might help others.
In this case when you modify the structure of the vendor the autoload is also updated.
If you are picking up the folder from a local and putting it into production, you should also send the updated autoload.