Skip to content

aambrogini/phpjasper

 
 

Repository files navigation

This project is a fork from PHPJasper/phpjasper but it has been modified to working into symfony applications.

Symfony

To get start in symfony, simple use the guide in the phpjasper example section but change paths and not use require autoload. Example (symfony 3.x controller):

<?php

namespace AppBundle\Controller;

use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
use PHPJasper\PHPJasper;

class DefaultController extends Controller {

    /**
     * @Route("/", name="default")
     */
    public function indexAction(Request $request) {
        $input = '/src/SymfonyProject/vendor/a.ambrogini/phpjasper/examples/hello_world.jrxml';   

        $output = '/src/SymfonyProject/vendor/a.ambrogini/phpjasper/examples';    
        $options = [ 
            'format' => ['pdf', 'rtf'] 
        ];

        $jasper = new PHPJasper;

        $jasper->process(
            $input,
            $output,
            $options
        )->execute();
        
        return $this->render('default/index.html.twig');
    }

}

About

A PHP report generator for use in symfony

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 93.5%
  • Shell 6.5%