I installed the package phpoffice/phpexcel via composer. Anyway the autoload does not work. I tried every combination of namespace to call the class but it's not there:
PHP Fatal error: Class 'PHPExcel\\PHPExcel' not found in
The code that is calling it:
$objPHPExcel = new \PHPExcel\PHPExcel();
composer.json looks nice:
{
"name": "Bjc/Iis",
"description": "A complete software suite for commerce",
"license": "MIT",
"keywords": ["commerce"],
"authors": [
{
"name": "me",
"email": "me@me"
}
],
"require": {
"phpmailer/phpmailer": "5.*",
"components/jquery": "2.*",
"twbs/bootstrap": "3.*",
"zendframework/zend-barcode": "*",
"zendframework/zend-validator": "*",
"phpoffice/phpexcel": "1.8.*"
},
"require-dev": {},
"autoload": {
"psr-4": {
"Bjc\\Iis\\": "src"
}
}
}
The command "composer update" ran nicely. The files of phpoffice/phpexcel also are in vendor/phpoffice/phpexcel as expected.
I call the composer autoloader in my script as follows (and it works e.g. with phpmailer):
require_once(__DIR__.'/../vendor/autoload.php');
Phpexcel also has references in all the autoloader files of composer:
vendor/composer/autoload_static has (beside others) these lines:
public static $prefixesPsr0 = array (
'P' =>
array (
'PHPExcel' =>
array (
0 => __DIR__ . '/..' . '/phpoffice/phpexcel/Classes',
),
),
);
And vendor/composer/autoload_namespaces.php looks like that:
// autoload_namespaces.php @generated by Composer
$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);
return array(
'PHPExcel' => array($vendorDir . '/phpoffice/phpexcel/Classes'),
);
Anybody who can see my error?