{"id":37007238,"url":"https://github.com/matiasiglesias/vmb-zf2-data-export-module","last_synced_at":"2026-01-14T00:46:36.414Z","repository":{"id":62525071,"uuid":"83931181","full_name":"matiasiglesias/vmb-zf2-data-export-module","owner":"matiasiglesias","description":"ZF2 Data Export Module to XLS, CSV and PDF","archived":false,"fork":true,"pushed_at":"2017-03-05T14:02:52.000Z","size":33,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-24T06:53:04.131Z","etag":null,"topics":["csv","export","module","pdf","php","xls","zf2"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"vitorbarros/vmb-zf2-data-export-module","license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/matiasiglesias.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-03-04T23:17:34.000Z","updated_at":"2017-03-05T05:38:39.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/matiasiglesias/vmb-zf2-data-export-module","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/matiasiglesias/vmb-zf2-data-export-module","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matiasiglesias%2Fvmb-zf2-data-export-module","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matiasiglesias%2Fvmb-zf2-data-export-module/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matiasiglesias%2Fvmb-zf2-data-export-module/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matiasiglesias%2Fvmb-zf2-data-export-module/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/matiasiglesias","download_url":"https://codeload.github.com/matiasiglesias/vmb-zf2-data-export-module/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matiasiglesias%2Fvmb-zf2-data-export-module/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28406589,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-13T21:51:37.118Z","status":"ssl_error","status_checked_at":"2026-01-13T21:45:14.585Z","response_time":56,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["csv","export","module","pdf","php","xls","zf2"],"created_at":"2026-01-14T00:46:35.893Z","updated_at":"2026-01-14T00:46:36.404Z","avatar_url":"https://github.com/matiasiglesias.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Módulo para exportação de dados em CSV, XSL, e PDF\nBased on [Módulo de exportação de dados de Vitor Monteiro de Barros](https://github.com/vitorbarros/vmb-zf2-data-export-module)\n\n## Instalação\n\n### Observação\nPara que o módulo funcione de forma correta, é necessário seguir as instruções de instalação do módulo do Doctrine.\n`https://github.com/doctrine/DoctrineORMModule`\n\n### ZF2 Data Export Module\n\nRode\n`php composer.phar require vitorbarros/vmb-zf2-data-export-module`\n\nApós, adicione os seguintes modulos  \n`DoctrineModule`, `DoctrineORMModule`, `DoctrineDataFixtureModule` and `VMBDataExport` no seguinte arquivo: `config/application.config.php`\n\nApós, crie o seguinte diertório com permissão de escrita\n`data/DoctrineORMModule/Proxy`\n\nCria os seguintes diretórios\n\n`public/xsl`\n\n`public/pdf`\n\n`public/csv`\n\n### Form ###\nYour form can extend VMBDataExportForm Class like this:\n\n```php\n\u003c?php\nnamespace MyModule\\Form;\n\nuse Zend\\Form\\Form;\n\nclass FilterClaimForm extends VMBDataExportForm {\n\n\tpublic function __construct($name = null, $options = array())\n\t{\n\t\tparent::__construct('my-form');\n\t\t\n\t\t/**\n\t\t* All your controls here\n\t\t*/\n\t}\n}\n```\n\n### Export de dados através de entidades\n\n```php\n//controller class\n\nuse Zend\\Mvc\\Controller\\AbstractActionController;\nuse VMBDataExport\\Form\\Export;\n\nclass YourController extends AbstractCrudController\n{\n  public function yourAction()\n  {\n    $form = new Export();\n    $form-\u003esetData(array(\n        'entity' =\u003e 'Your\\Entity\\NameSpace',\n        //Condições da query\n        'criteria' =\u003e Json::encode(array()),\n        //Tipos suportados xls, pdf, csv\n        'type' =\u003e 'xls',\n        //url to redirect\n        'redirect_to' =\u003e '/interno/super-admin/cursos',\n        //headers\n        'headers' =\u003e Json::encode(array(\n            'event_nome',\n            'event_data_inicio',\n            'event_data_final',\n            'event_descricao',\n        )),\n    ));\n    return new ViewModel(\n      array(\n          'form' =\u003e $form,\n      )\n    );\n  }\n}\n\n//view\n\u003c?php $form = $this-\u003eform; ?\u003e\n\u003c?php $form-\u003esetAttribute('action', '/export'); ?\u003e\n\u003c?php $form-\u003eprepare(); ?\u003e\n\n\u003c?php echo $this-\u003eform()-\u003eopenTag($form); ?\u003e\n\n  \u003c?php echo $this-\u003eformhidden($form-\u003eget('entity')); ?\u003e\n  \u003c?php echo $this-\u003eformhidden($form-\u003eget('criteria')); ?\u003e\n  \u003c?php echo $this-\u003eformhidden($form-\u003eget('type')); ?\u003e\n  \u003c?php echo $this-\u003eformhidden($form-\u003eget('redirect_to')); ?\u003e\n  \u003c?php echo $this-\u003eformhidden($form-\u003eget('headers')); ?\u003e\n  \u003c?php echo $this-\u003eformsubmit($form-\u003eget('submit')); ?\u003e\n\n\u003c?php echo $this-\u003eform()-\u003ecloseTag();\n\n```\n\n### Export Throw service injected in your Controller\n\n```php\n\nnamespace MyNameSpace\n\nuse VMBDataExport\\Service\\MainService;\nclass MyController\n{\n\tprivate $exportService;\n\t\n\tpublic function __contruct(MainService $exportService)\n\t{\n\t\t$this-\u003eexportService = $exportService;\n\t}\n\t\n\tpublic function CustomAction() {\n\t\t$filename = $this-\u003eexportService-\u003estrategy('xls', [\n\t\t'entity' =\u003e 'My\\Entity\\Name',\n\t\t\t'method' =\u003e 'filter', //You can call a custom Entity Repository Method\n          'criteria' =\u003e Json::encode(\n          \t[$your_criteria_array]\n\t\t\t),\n\t\t\t'headers' =\u003e Json::encode([\n\t\t\t\t'field1',\n             \t'field2',\n             \t// ...\n\t\t\t]),\n\t\t]);\n\t\t\n\t\treturn $this-\u003eredirect()-\u003etoUrl($filename);\n\t}\n}\n```\n\n### Export de dados com query customizada\n\n```php\n//controller class\n\nuse Zend\\Mvc\\Controller\\AbstractActionController;\nuse VMBDataExport\\Service\\CustomExportService;\n\nclass YourController extends AbstractCrudController\n{\n\n  /**\n   * @var CustomExportService\n   */\n  private $customExportService;\n\n  /**\n   * ExportController constructor.\n   * @param CustomExportService $customExportService\n   */\n  public function __construct(CustomExportService $customExportService)\n  {\n      $this-\u003ecustomExportService = $customExportService;\n  }\n\n  public function yourAction()\n  {\n    $sql = \"Your query\";\n\n    $filePath = $this-\u003ecustomExportService-\u003eexport($sql, array(\n        'your',\n        'header',\n        'fields'\n    ), 'xls');\n\n    return $this-\u003eredirect()-\u003etoUrl($filePath);\n  }\n}\n\n```\n#### Acesse o navegador\n`yourdomain.com.br/your-export-action`\n\n### TODO\nFinalizar a classe `VMBDataExport\\Export\\PDFExport`\n\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmatiasiglesias%2Fvmb-zf2-data-export-module","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmatiasiglesias%2Fvmb-zf2-data-export-module","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmatiasiglesias%2Fvmb-zf2-data-export-module/lists"}