PHP code example of ryodevz / phpexport

1. Go to this page and download the library: Download ryodevz/phpexport 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/ */

    

ryodevz / phpexport example snippets




use Ryotwell\Phpexport\Support\Facade\Export;

// Init the class
$exporter = new Export;

// The html
$html = '<h1>Lorem ipsum dolor sit amet consectetur adipisicing elit. Error, ratione.</h1>';

// Export to PDF and download
$exporter->makePDF($html)
    ->download('document.pdf'); // This parameter is optional, with the default value of 'filename.pdf'.

// Export to PDF and preview
$exporter->makePDF($html)
    ->preview(); // The method preview() is only available for PDF

// Export to Excel and download
$exporter->makeExcel($html)
    ->download();

// Export to MSWord and download
$exporter->makeWord($html)
    ->download();