All plugins in Kirby work the same way as explained in the docs:
You have to create a plugin folder with an index.php inside. Then in your index.php you can load your dependencies, either via composer autoload, loading manually with require or with Kirby’s load() function.
You have to create a plugin folder with an index.php inside. Then in your index.php you can load your dependencies, either via composer autoload, loading manually with require or with Kirby’s load() function.
You mean in the PhpSpreadsheet-folder I have to add a index.php?
And then adding this to index.php?
<?php
require 'vendor/autoload.php';
use PhpSpreadsheet\Spreadsheet;
?>
And then I can use it for example in a model like this?
$reader = new PhpSpreadsheet\Spreadsheet\Reader\Xlsx();
It does not work.
To the documentation:
Sorry, but in my opinion, the documentation is for php-experts who already know the big picture.
For me it always feels like important explanations are missing because it is assumed that you already know it - I’m completely lost there. Or maybe coding in general is just an overkill for my cognitive possibilities
@pixelijn
Thanks again for your patience.
I found out a way to install a thirdparty plugin.
For all the dumpheads like me out there
Here is the **step by step instruction to install (with composer) and use the phpspreadsheed library **:
Create a folder called “phpspreadsheet” in \site\plugins (create “plugins” if it does not exist yet)
In the terminal switch into \site\plugins\phpspreadsheet
Run composer require phpoffice/phpspreadsheet
Choose “no” if the terminal asks you to use composer.json from the root directory. Else you will end up in a dependency-mess!
In \site\plugins\phpspreadsheet create the file index.php
In this index.php write this <?php require 'vendor/autoload.php'; use PhpOffice\PhpSpreadsheet\Spreadsheet;?>
Then from a model you can read the data from an excelfile like this:
$reader = new \PhpOffice\PhpSpreadsheet\Reader\Xlsx();
$spreadsheet = $reader->load($this->root() . “/offersdata.xlsx”);
Full example witch just returns the number of rows (yes, very useful ;-)):
(Continue the tutorial at the bottom if you wanna do more usefull things).