### Install Documentation Dependencies Source: https://github.com/sonata-project/exporter/blob/3.x/CONTRIBUTING.md Install required Python dependencies for building documentation using pip. ```bash pip install --requirement docs/requirements.txt --user ``` -------------------------------- ### Install Sonata Exporter via Composer Source: https://github.com/sonata-project/exporter/blob/3.x/docs/reference/installation.rst Use this command to add the core library to your project dependencies. ```bash composer require sonata-project/exporter ``` -------------------------------- ### Install XLSX support via Composer Source: https://github.com/sonata-project/exporter/blob/3.x/docs/reference/installation.rst Required only if you need to export data in the XLSX format. ```bash composer require phpoffice/phpspreadsheet ``` -------------------------------- ### Good commit message subject example Source: https://github.com/sonata-project/exporter/blob/3.x/CONTRIBUTING.md An example of a concise and descriptive commit message subject. ```text Document how to install the project ``` -------------------------------- ### Exporting data with Sonata Exporter Source: https://github.com/sonata-project/exporter/blob/3.x/docs/reference/introduction.rst Demonstrates the basic setup using an iterator source and a writer to export data. ```php // This can be any instance of \Iterator $source = new ArraySourceIterator([/* your data */]); // This could be any format supported $writer = new JsonWriter('php://output'); $handler = Handler::create($source, $writer); $handler->export(); ``` -------------------------------- ### PHPStan Annotation Example Source: https://github.com/sonata-project/exporter/blob/3.x/CONTRIBUTING.md Use @phpstan- annotations for static analysis to maintain IDE support and consistency. ```php /** * @param Bar|Baz $foo * @param class-string $class * @param int $limit a crucial, fascinating comment * * @return object * * @phpstan-template T of object * @phpstan-param class-string $class * @phpstan-return T */ protected function bar($foo, string $class, int $limit): object { // ... } ``` -------------------------------- ### Bad commit message subject example Source: https://github.com/sonata-project/exporter/blob/3.x/CONTRIBUTING.md An example of a vague commit message subject that lacks sufficient context. ```text Update README.md ``` -------------------------------- ### Commit message with description Source: https://github.com/sonata-project/exporter/blob/3.x/CONTRIBUTING.md An example of a commit message including a detailed description that provides context for the changes. ```text Change web UI background color to pink This is a consensus made on #4242 in addition to #1337. We agreed that blank color is boring and so deja vu. Pink is the new way to do. ``` -------------------------------- ### Commit message with technical explanation Source: https://github.com/sonata-project/exporter/blob/3.x/CONTRIBUTING.md An example of a commit message that states technical facts and explains the reasoning behind a fix. ```text call foo::bar() instead of bar::baz() This fixes a bug that arises when doing this or that, because baz() needs a flux capacitor object that might not be defined. Fixes #42 ``` -------------------------------- ### View Documentation Locally Source: https://github.com/sonata-project/exporter/blob/3.x/CONTRIBUTING.md Open the generated documentation in a browser after running the build process. ```bash $YOUR_FAVORITE_BROWSER docs/_build/html/index.html ``` -------------------------------- ### Run PHP Coding Standard Fixer Source: https://github.com/sonata-project/exporter/blob/3.x/CONTRIBUTING.md Execute this command before committing to ensure code adheres to project standards. ```bash php-cs-fixer fix --verbose ``` -------------------------------- ### Enable the SonataExporterBundle Source: https://github.com/sonata-project/exporter/blob/3.x/docs/reference/symfony.rst Register the bundle in the application's bundles configuration file. ```php // config/bundles.php return [ // ... Sonata\Exporter\Bridge\Symfony\SonataExporterBundle::class => ['all' => true], ]; ``` -------------------------------- ### Configure writer settings Source: https://github.com/sonata-project/exporter/blob/3.x/docs/reference/symfony.rst Define custom settings for specific exporter formats in the package configuration file. ```yaml # config/packages/sonata_exporter.yaml sonata_exporter: writers: some_format: some_setting: some_value ``` -------------------------------- ### Configure default writers Source: https://github.com/sonata-project/exporter/blob/3.x/docs/reference/symfony.rst Specify the list of default writers enabled for the exporter. ```yaml # config/packages/sonata_exporter.yaml sonata_exporter: exporter: default_writers: - csv - json ``` -------------------------------- ### Marking code for future removal with NEXT_MAJOR Source: https://github.com/sonata-project/exporter/blob/3.x/CONTRIBUTING.md Use the NEXT_MAJOR comment marker to indicate code that should be uncommented or reworked in a future major release. ```php tag within the service definition in XML configuration files. ```xml The "%service_id%" service is deprecated since sonata-project/bar-bundle 42.x and will be removed in 43.0. ``` -------------------------------- ### Trigger deprecation for legacy logic Source: https://github.com/sonata-project/exporter/blob/3.x/CONTRIBUTING.md Use @trigger_error inside conditional blocks to warn users about legacy code paths. ```php