vendredi 27 avril 2018

How to properly install Phpspreadsheet in laravel 5.5

Objective

I'm trying to run the package PhpSpreadsheet on Laravel.

Problem

When I try to execute the hello example from the documentation, but I got this error:

main(): Failed opening required 'vendor/autoload.php' (include_path='C:\xampp\php\PEAR')

Steps

I've tried to follow the documentation then I did the following:

  1. After running: composer require phpoffice/phpspreadsheet I got this result

  2. composer update gave me this

  3. Finally,I tried to run the hello-example class as follow:

      require 'vendor/autoload.php';
     class Spread{
    public function fun(){
    $spreadsheet = new Spreadsheet();
    $sheet = $spreadsheet->getActiveSheet();
    $sheet->setCellValue('A1', 'Hello World !');
    
    $writer = new Xlsx($spreadsheet);
    $writer->save('helloz world.xlsx');
    }
    
    

Composer.json

composer.json



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire