PHP code example of metin / exodus

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

    

metin / exodus example snippets


$exporter = new ExportManager(new CsvExporter());
$options = new ExportOptions(
    path: '/path/to/export',
    delimiter: ',',
    

use Metin\Exodus\Core\ExportManager;
use Metin\Exodus\Exporters\CsvExporter;
use Metin\Exodus\Dto\ExportOptions;
// Prepare data
$data = [
    ['name' => 'John Doe', 'email' => '[email protected]'],
    ['name' => 'Jane Doe', 'email' => '[email protected]']
];
// Configure export options
$options = new ExportOptions(
    path: '/path/to/export',
    delimiter: ',',
    

use Metin\Exodus\Core\ExportManager;
use Metin\Exodus\Exporters\JsonExporter;
use Metin\Exodus\Dto\ExportOptions;

// Prepare data
$data = [
    ['name' => 'John Doe', 'email' => '[email protected]'],
    ['name' => 'Jane Doe', 'email' => '[email protected]']
];

// Configure export options
$options = new ExportOptions(
    path: '/path/to/export',
    filename: 'users.json',
    formatOptions: [
        'prettyPrint' => true,
        'unescapeUnicode' => true
    ]
);

// Create exporter and process
$exporter = new ExportManager(new JsonExporter());
$result = $exporter->process($data, $options);

if ($result->success) {
    echo "File exported to: " . $result->path;
} else {
    echo "Export failed: " . $result->error;
}