PHP code example of enflow / laravel-excel-exporter

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

    

enflow / laravel-excel-exporter example snippets


'exports' => [
    // key => Export class (must be resolvable from the container)
    'teams' => \App\Exports\TeamsExport::class,
],

use Enflow\LaravelExcelExporter\Commands\PushAll;

$schedule->command(PushAll::class)->dailyAt('03:00')->environments('production');

use Enflow\LaravelExcelExporter\Exporters\GoogleSheet\ExportableToGoogleSheet;

class TeamsExport implements ExportableToGoogleSheet
{
    public function googleSpreadsheetId(): string
    {
        return 'your-spreadsheet-id';
    }
    
    // ... other export methods
}

use Enflow\LaravelExcelExporter\Exporters\GoogleBigQuery\ExportableToGoogleBigQuery;

class TeamsExport implements ExportableToGoogleBigQuery
{
    public function googleBigQueryTableId(): string
    {
        return 'teams';
    }

    public function googleBigQuerySchema(): array
    {
        // column => BigQuery type (e.g. STRING, INT64, FLOAT64, BOOL, TIMESTAMP, DATE)
        return [
            'id' => 'INT64',
            'name' => 'STRING',
            'created_at' => 'TIMESTAMP',
        ];
    }
}
bash
php artisan vendor:publish --tag="laravel-excel-exporter-config"
bash
php artisan excel-exporter:push