PHP code example of solve-x / export-tools

1. Go to this page and download the library: Download solve-x/export-tools 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/ */

    

solve-x / export-tools example snippets




use SolveX\ExportTools\ExcelExporter;

$db = app('db'); // Illuminate\Database\ConnectionInterface (Laravel)
$excelExporter = new ExcelExporter($db);

$sql = "SELECT first_name, last_name, phone, email FROM `customers` WHERE id = 1";
$columns = ['First Name', 'Last Name', 'Phone', 'Email'];

$path = $excelExporter->export($sql, $columns);