2017 © Pedro Peláez
 

symfony-bundle auto-reporting-bundle

Send daily PDF reports about the application's activity

image

sbc/auto-reporting-bundle

Send daily PDF reports about the application's activity

  • Monday, May 14, 2018
  • by SlimenTN
  • Repository
  • 1 Watchers
  • 0 Stars
  • 13 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 63 % Grown

The README.md

AutomaticReportingBundle

Send daily PDF reports about the application's activity., (*1)

Installation

  1. composer require sbc/auto-reporting-bundle
  2. Enable the bundle in AppKernel.php new SBC\AutomaticReportingBundle\AutomaticReportingBundle(),

Usage

Step 1:

Set the configuration:
, (*2)

# 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:, (*3)

/**
 * 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:, (*4)

/**
 * 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., (*5)

The Versions

14/05 2018

dev-master

9999999-dev

Send daily PDF reports about the application's activity

  Sources   Download

MIT

The Requires

 

by Slimen Arnaout
by Haouass Abderraouf

reporting bundle symfony reporting mail reporting