定制 smoq/database-dump-bundle 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

smoq/database-dump-bundle

最新稳定版本:v1.0.1

Composer 安装命令:

composer require smoq/database-dump-bundle

包简介

A small Symfony bundle that allows for database dump from the client side in excel or sql format

README 文档

README

This bundle allows to easily dump a full database to an excel file or an SQL file.

Usage

example in a controller :

#[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;
}

Simply replace ExcelDumper by SqlDumper to create a .sql file instead (don't forget to replace the extension in the filepath !).

If you only want to dump the schema of the database, without its data, you can use the DumperInterface::dumpSchema method.

Excel dumper

Please note that when using the excel dumper, the file format is specified by the file extension (string after the last dot). If the file format isn't supported, it will default throw an error

Sql dumper

If you try to exclude an entity which another depends upon, without excluding the other one, an error will be thrown, as the generated sql file would be broken otherwise.

统计信息

  • 总下载量: 4
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-06-03

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固