PHP code example of smoq / database-dump-bundle
1. Go to this page and download the library: Download smoq/database-dump-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/ */
smoq / database-dump-bundle example snippets
#[Route("/database/dump/excel", name: "app_dump_database_excel")]
function dumpDatabase(ManagerRegistry $doctrine, ExcelDumper $dumper): BinaryFileResponse
{
$filepath = getcwd() . "/exports/dump.xlsx";
// dump the db to a .xlsx file
$dumper->dumpToFile($filepath, ["doctrine_migration_versions"], true);
$response = new BinaryFileResponse($filepath);
$response->setContentDisposition(
ResponseHeaderBag::DISPOSITION_ATTACHMENT,
"dump.sql"
);
// return it as an attachment (download it to the user's computer)
return $response;
}