1. Go to this page and download the library: Download ralphmorris/exporter 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/ */
ralphmorris / exporter example snippets
use RalphMorris\Exporter\Exporter;
public function export()
{
$users = User::get();
$exporter = new Exporter;
return $exporter->exportToCsv($users);
}
namespace App;
use Illuminate\Database\Eloquent\Model;
use RalphMorris\Exporter\ExportableColumnsTrait;
class User extends Model
{
use ExportableColumnsTrait;
/**
* The columns that are exportable to CSV
*
* @var array
*/
protected $exportableColumns = [
'name',
'email',
];
public function export()
{
$users = User::exportableColumns()->get();
$exporter = new Exporter;
return $exporter->exportToCsv($users);
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.