solve-x/export-tools

There is no license information available for the latest version (v0.1.4) of this package.

Export tools

v0.1.4 2017-09-11 12:58 UTC

This package is not auto-updated.

Last update: 2024-04-14 00:59:47 UTC


README

Fast MySQL-to-Excel exporter

This library uses MySQL's SELECT INTO OUTFILE feature to export selected rows into a csv file and then converts that csv into xlsx via a C-language program (Linux only). This is much faster than other pure PHP solutions.

Example usage:

<?php

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);