I found this on SO: How to use PHPExcel correctly with Symfony 2
This works, but I want to use it with composer. The first part I already solved: to load PHPExcel for a special tag (the last stable release)
I don't find out how to fetch a tag with this syntax:
"repositories": [
{
"type": "vcs",
"url": "https://github.com/umpirsky/SyliusAssortmentBundle"
}
]
So I use the Package
notation:
I found out, the reference
should be the tag name on github.
And the version
cannot be the same value (PHPExcel_1.7.8). Seems that alphabetical characters are not allowed, so it's only the version as a number (1.7.8)
"repositories": [{
"type": "package",
"package": {
"name": "PHPOffice/PHPExcel",
"version": "1.7.8",
"source": {
"url": "https://github.com/PHPOffice/PHPExcel.git",
"type": "git",
"reference": "PHPExcel_1.7.8"
}
}
}]
The next step I didn't solve. I tried out every combination for the autoloading: psr-0, classmap, different paths, relative to project/vendor/phpexcel, update composer everytime, but nothing worked.
It only works, if I put this line
$loader->add('PHPExcel', __DIR__.'/../vendor/PHPOffice/PHPExcel/Classes');
into the app/autoload.php. I found out, that the first string (PHPExcel
) can also be an empty string: ''
.
Is there a differnece if I use PHPExcel
or ''
?
So my primary question is, how can I avoid to write this line into the autoload.php, put the equivalent commands into my project's composer.json?
will reinstall it with the latest information from your composer.json, including autoload, etc.
? How can I include / enable autoload for PHPExcel, which has no own composer.json and no namespaces? – Deforce