sbc / auto-reporting-bundle
Send daily PDF reports about the application's activity
Installs: 190
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Type:symfony-bundle
Requires
- php: >=5.5.9
- dompdf/dompdf: ^0.8.2
- symfony/framework-bundle: ^2.8 || ^3.0
This package is not auto-updated.
Last update: 2025-04-16 07:21:10 UTC
README
Send daily PDF reports about the application's activity.
Installation
composer require sbc/auto-reporting-bundle
- Enable the bundle in AppKernel.php
new SBC\AutomaticReportingBundle\AutomaticReportingBundle(),
Usage
Step 1:
Set the configuration:
# AutomaticReportingBundle configuration
automatic_reporting:
app_name: 'Your applciation name' # will be displayed in the email
recipients: ['mail1@site.com', 'mail2@site.com'] # multiple recipients
Step 2:
Call @Report
Annotation in the entities you want to follow:
/** * Post * * @ORM\Table(name="post") * @ORM\Entity(repositoryClass="AppBundle\Repository\PostRepository") * * @Report( * dateColumn="creationDate", * reportingName="Poste" * ) */ class Post { ... }
Step 2 (differentiation solution):
You can also separate result for the same entity using the DifferentiationColumn Annotation:
/** * Post * * @ORM\Table(name="post") * @ORM\Entity(repositoryClass="AppBundle\Repository\PostRepository") * * @Report( * dateColumn="creationDate", * differentiationColumn="type", * differentiations={ * @DifferentiationColumn(value="A", reportingName="Post of type A"), * @DifferentiationColumn(value="B", reportingName="Post of type B") * } * ) */ class Post { ... /** * Type of the Post entity * @var string * * @ORM\Column(name="type", type="string", length=255) */ private $type; }
Step3
- Call
php bin/console reporting:generate
to build and send the report - Or create a cron job that trigger this command every day
What will actually happen ?
After calling the command the bundle will parse and get all the entities with the @Report
annotation and
count all the rows that being created in the current day using the dateColumn
attribute,
after that the bundle will generate and send a PDF attachment to the recipients containing the summary using the reportingName
attribute for each entity.