Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/getparthenon/export-bundle
A Symfony bundle to make providing data exports easy
https://github.com/getparthenon/export-bundle
Last synced: 3 days ago
JSON representation
A Symfony bundle to make providing data exports easy
- Host: GitHub
- URL: https://github.com/getparthenon/export-bundle
- Owner: getparthenon
- License: gpl-3.0
- Created: 2022-12-09T09:39:54.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-06-19T22:22:44.000Z (5 months ago)
- Last Synced: 2024-06-21T11:08:17.352Z (5 months ago)
- Language: PHP
- Homepage:
- Size: 275 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
README
Export Bundle
## Description
A utlity Symfony bundle to help with export data from Symfony applications.
It allows exports by default in the formats `csv` and `xlsx`. With the ability to add support for more formats via custom Exporters.
This bundle allows you to export data via 3 methods: Direct Download, Background Download, Background Email. More info [here](#export-engines)
## Getting Started
To add to your project
`composer require parthenon/export-bundle`
## Requirements
* PHP 8.1+
* Symfony 6+## Support
Support is provided via GitHub, Slack, and Email.
If you have a commercial license you will be able to list the GitHub accounts that you want to link to the license. This
means when an issue is created by an account linked to a commercial license they will get priority support. All other
issues will be given best effort support.* Github: You can make an issue on [getparthenon/monorepo](https://github.com/getparthenon/monorepo/issues/new/choose)
* Email: [email protected]
* Slack: [Click here](https://join.slack.com/t/parthenonsupport/shared_invite/zt-1kmmuvul0-Ai1Sp6j3SzlF955Z~CD~~Q) to signupIssues we will provide support and fixes for:
* Defects/Bugs
* Performance issues
* Documentation fixes/improvements
* Lack of flexibility
* Feature requests## Example Usage
```php
namespace App\Controller;use App\Export\DemoDataProvider;
use Parthenon\Export\Engine\EngineInterface;
use Parthenon\Export\Exporter\ExporterManagerInterface;
use Parthenon\Export\Exporter\ExporterManagerInterface;
use Parthenon\Export\Response\ResponseConverterInterface;
use Parthenon\Export\Entity\BackgroundExportRequest;
use Parthenon\Export\Repository\BackgroundExportRequestRepositoryInterface;class ExportController
{
public function export(Request $request, EngineInterface $engine, ResponseConverterInterface $responseConverter)
{
$exportName = $request->get("name");
$exportFormat = $request->get("format");$exportRequest = new ExportRequest($exportName, $exportFormat, DemoDataProvider::class, $parameters);
$response = $engine->process($exportRequest);
return $responseConverter->convert($response);
}
public function downloadWaiting(Request $request, LoggerInterface $logger, BackgroundExportRequestRepositoryInterface $backgroundExportRequestRepository, Environment $twig)
{
$id = $request->get('id');/** @var BackgroundExportRequest $backgroundExportRequest */
$backgroundExportRequest = $backgroundExportRequestRepository->findById($id);$downloadUrl = $backgroundExportRequest->getExportedFilePath();
if ($downloadUrl) {
return new RedirectResponse($downloadUrl);
} else {
return new Response($twig->render('export_background_download.html.twig'));
}
}
}
```### Data Provider
```php
repository->findAll();
}
}
```## Documentation
You can find the full documentation in [Parthenon Docs for Export](https://getparthenon.com/docs/next/export/overview)
## Export Engines
### Direct Download
This is where the export is generated within the HTTP request and a download file is provided.
### Background Download
This is where the export is generated within the background via Symfony Messenger and once the download is generated it's saved to a storage area and then the user can download it.
#### Configuration
The file uploading part of the background download engine is handled by the common module of Parthenon. The full documentation can be found [here](https://getparthenon.com/docs/next/common/upload/).
If you want to save the file to a local folder the configuration below can help.
```yaml
parthenon:
common:
uploader:
default:
provider: local
naming_strategy: time_random
local:
path: "%kernel.project_dir%/public/uploads"
```
### Background EmailThis is where the export is generated within the background via Symfony Messenger. Once the export is generated it's emailed to the requesting user.
The email sending part of this engine is handled by the Notification module of Parthenon. The full documentation can be found at [here](https://getparthenon.com/docs/next/notification/email)
If you're already using Symfony Mailer and just want that to be used then the configuration below is what is needed.
```yaml
parthenon:
notification:
type: symfony
```## FAQ
### Is this Open Source?
Yes. This bundle has been released under the GPL V3 License.
### Why is this Open Source while Parthenon is source available?
This has been released under an open source license for two reasons. One is that data exports is a source of technical debt for many tech teams and I wanted this to be useful to as many people as possible as I feel it really helps solve the issue for many teams.
The other reason is to see the usage and bug reports, etc from an open source version.
### If this is released under GPL and Parthenon contains this code, shouldn't Parthenon legally be GPL?
No. As the copyright holder the GPL license doesn't apply to me and I'm legally entitled to distribute it how I want, relicense it, etc. GPL only affects people who fork this bundle.
### What support is available for this bundle?
This bundle comes with community level support, which is best efforts. You can get a professional support by paying for a Parthenon license. Which is $250 per developer per year.