Third party assets in packages in 5.7?

Permalink
Hey there,

I want to use the SimplePie RSS Library in a package. What is the 5.7-way of doing this? Could not find a specific documentation for this.

There was a guide for 5.6 by JohnTheFish:
http://www.concrete5.org/documentation/how-tos/developers/third-par...

Thanks in advance!

programmieraffe
View Replies:
MrKDilkington replied on at Permalink Reply
MrKDilkington
I am interested in this also.
stefancrs replied on at Permalink Reply
stefancrs
Me too :)
stefancrs replied on at Permalink Reply
stefancrs
So, here's what worked for me (including PHPExcel in my package):

I put the classes in
my_package/vendor/PHPExcel/

which also included
my_package/vendor/PHPExcel.php

Then, in my package controller, I do
require_once(__DIR__ . '/vendor/PHPExcel.php');

And now I can use the classes.
MrKDilkington replied on at Permalink Reply
MrKDilkington
Thank you, I am looking forward to trying this out.

PHPExcel looks really useful too. I'd be curious to try importing data with it.
ntisithoj replied on at Permalink Reply
ntisithoj
perhaps an obvious point, but for the less acute (I wasted time trying to 'figure it out')... if you are moving your tree from /concrete/vendor to /packages/blah/vendor, remember to update the composer/autoload_files.php and remove the entry pointing to /composer ... otherwise you get a blank white screen with no error messages.

(oops... this was for a different thread! Can I delete this ?)
MrKDilkington replied on at Permalink Reply
MrKDilkington
BTW stefancrs,

Are you able to share some code examples of how you used PHPExcel in concrete5?
stefancrs replied on at Permalink Reply
stefancrs
Sure!

I use it for importing data, a simple three-column excel file is submitted via a form and then data gets extracted:

if(isset($_FILES["excelFile"])) {
         $filename = $_FILES["excelFile"]["tmp_name"];
         /**  Identify the type of $inputFileName  **/
         $inputFileType = PHPExcel_IOFactory::identify($filename);
         /**  Create a new Reader of the type that has been identified  **/
         $objReader = PHPExcel_IOFactory::createReader($inputFileType);
         /**  Load $inputFileName to a PHPExcel Object  **/
         $objPHPExcel = $objReader->load($filename);
         $worksheet = $objPHPExcel->getActiveSheet();
         $rows = $worksheet->getHighestRow();
         // rows start at row 1, which contain our titles, data starts at row 2
         $importData = array();
         $articleGroups = array();
         $articleGroupProducts = array();
         for($row = 2; $row < $rows; $row++) {
MrKDilkington replied on at Permalink Reply
MrKDilkington
Thank you, this is very interesting.