PHP code example of zahfouf / php-libreoffice

1. Go to this page and download the library: Download zahfouf/php-libreoffice library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

zahfouf / php-libreoffice example snippets




use LibreOffice\LibreOffice;

$lo = new LibreOffice();

$result = $lo->convert('C:/docs/report.docx')->to('pdf', ['output_dir' => 'C:/docs/out']);

echo $result->outputPath . PHP_EOL;
echo $result->durationMs . PHP_EOL;

// Static usage (without instantiating):

$result = LibreOffice::make()->convert('C:/docs/report.docx')->to('pdf', ['output_dir' => 'C:/docs/out']);
bash
composer