1. Go to this page and download the library: Download tourze/async-export-bundle 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/ */
tourze / async-export-bundle example snippets
use AsyncExportBundle\Entity\AsyncExportTask;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Component\Security\Core\Security;
// Create a new export task
$task = new AsyncExportTask();
$task->setDql('SELECT u FROM App\Entity\User u WHERE u.active = true');
$task->setEntityClass('App\Entity\User');
$task->setColumns(['id', 'email', 'name', 'createTime']);
$task->setFile('users_export.csv');
$task->setRemark('Export active users');
$task->setUser($security->getUser()); // Associate with current user
$task->setValid(true);
// Save the task
$entityManager->persist($task);
$entityManager->flush();
// The task is now ready for background processing
// Use Symfony Messenger or similar for async execution