PHP code example of tatter / exports

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

    

tatter / exports example snippets


// Loaded directly
$handler = new \Tatter\Exports\Exporters\DownloadExporter($myFile);`

// Located by Handlers
$class    = ExporterFactory::find('download');
$exporter = new $class($myFile);

$exporter->setFile('/path/to/file');
// or...
$file = new \CodeIgniter\Files\File('/path/to/file');
$exporter->setFile($file);

$exporter->setFileName('RenameFileDuringExport.bam');
$exporter->setFileMime('overriding/mimetype');

use Tatter\Exports\ExporterFactory;

class MyController
{
    public function previewFile($path)
    {
        $class    = ExporterFactory::find('preview');
        $exporter = new $class();

        return $exporter->setFile($path)->process();
    }
}