Я установил два пакета с composer в unbuntu 16:
- phpoffice / phpspreadsheet
- setasign / fpdi-tcpdf: 2.1
оба имеютУстановлено нормально, вот вывод из phpoffice.
Using version ^1.5 for phpoffice/phpspreadsheet
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 3 installs, 0 updates, 0 removals
- Installing markbaker/complex (1.4.7): Downloading (100%)
- Installing psr/simple-cache (1.0.1): Downloading (100%)
- Installing phpoffice/phpspreadsheet (1.5.2): Downloading (100%)
phpoffice/phpspreadsheet suggests installing mpdf/mpdf (Option for rendering PDF with PDF Writer)
phpoffice/phpspreadsheet suggests installing dompdf/dompdf (Option for rendering PDF with PDF Writer)
phpoffice/phpspreadsheet suggests installing jpgraph/jpgraph (Option for renderi ng charts, or including charts with PDF or HTML Writers)
Writing lock file
Generating autoload files
для обоих я использовал базовый пример на их домашней странице, например, phpoffice one (https://phpspreadsheet.readthedocs.io/en/develop/)
<?php
require 'vendor/autoload.php';
use PhpOffice\PhpSpreadsheet\Spreadsheet;
use PhpOffice\PhpSpreadsheet\Writer\Xlsx;
$spreadsheet = new Spreadsheet();
$sheet = $spreadsheet->getActiveSheet();
$sheet->setCellValue('A1', 'Hello World !');
$writer = new Xlsx($spreadsheet);
$writer->save('hello world.xlsx');
При выполнении этого я получаю следующеев журнале ошибок apache (я получаю аналогичное при запуске fpdi-tcpdf.)
[Thu Dec 06 21:14:42.835498 2018] [:error] [pid 1582] [client 192.168.223.1:53200] PHP Warning: require(vendor/autoload.php): failed to open stream: No such file or directory in /var/www/html/custom/excel.php on line 3
[Thu Dec 06 21:14:42.835716 2018] [:error] [pid 1582] [client 192.168.223.1:53200] PHP Fatal error: require(): Failed opening required 'vendor/autoload.php' (include_path='.:/usr/share/php') in /var/www/html/custom/excel.php on line 3