I need to generate Excel files, I did a search and phpexcel seems to be good and stable. I'd like to know: * how to integrate it into my project given that it's a symfony2.0 project * if I can do all what I do normally on excel file through this php library (cells colors, adding lists ...)
Thanks,
If you are using composer, and since PHPExcel is registered with Packagist, then this is simply a matter of adding PHPExcel to your composer.json config, for example:
This is from a Symfony 2.4 configuration, but should work equally well for any version of Symfony.
Run
$ php composer.phar updateto grab the package and it should then be autoloaded into your project. You can then use PHPExcel immediately, say in a controller:Or just reference
\PHPExceldirectly from within your code.Update:
Note that composer found it's way into Symfony from around version 2.0.4, and was used as an alternative to the old
depsanddeps.lockfiles until the deps approach was deprecated from 2.1.If you're still using deps, you can append this to your deps file:
and run
php bin/vendors install. This will put the PHPExcel invendors/phpexcel.Register PHPExcel with the
registerPrefixesarray inapp/autoload.phpand it should be available to your project as described above.