8000 Update README.md by geekcom · Pull Request #9 · lavela/phpjasper · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Update README.md #9

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Mar 10, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 53 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# JasperReports for PHP v1.0
# JasperReports for PHP and Laravel Framework

[![Latest Stable Version](https://poser.pugx.org/lavela/phpjasper/v/stable)](https://packagist.org/packages/lavela/phpjasper) [![Latest Unstable Version](https://poser.pugx.org/lavela/phpjasper/v/unstable)](https://packagist.org/packages/lavela/phpjasper) [![License](https://poser.pugx.org/lavela/phpjasper/license)](https://packagist.org/packages/lavela/phpjasper) [![Total Downloads](https://poser.pugx.org/lavela/phpjasper/downloads)](https://packagist.org/packages/lavela/phpjasper)

Expand Down Expand Up @@ -161,7 +161,7 @@ foreach($output as $parameter_description)
print $parameter_description . '<pre>';
```

###Advanced example
###Advanced example - using a database

We can also specify parameters for connecting to database:

Expand Down Expand Up @@ -190,7 +190,6 @@ $jasper->process(
)->execute();
```


###Using JasperPHP with Laravel 5.2!

1. Install [Composer](http://getcomposer.org) if you don't have it.
Expand Down Expand Up @@ -245,6 +244,57 @@ Route::get('/reports', function () {
In this example we generate reports pdf, rtf and xml.


###Additional Information - Reports from a xml in Laravel 5.2

See how easy it is to generate a report with a source an xml file:

```php

use JasperPHP\JasperPHP;

public function xmlToPdf()
{
$output = public_path() . '/report/'.time().'_CancelAck';
$output = public_path() . '/report/'.time().'_CancelAck';
$ext = "pdf";
$data_file = public_path() . '/report/CancelAck.xml';
$driver = 'xml';
$xml_xpath = '/CancelResponse/CancelResult/ID';

\JasperPHP::process(
public_path() . '/report/CancelAck.jrxml',
$output,
array($ext),
array(),
array('data_file' => $data_file, 'driver' => $driver, 'xml_xpath' => $xml_xpath),
false,
false
)->execute();

header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename='.time().'_CancelAck.'.$ext);
header('Content-Transfer-Encoding: binary');
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Content-Length: ' . filesize($output.'.'.$ext));
flush();
readfile($output.'.'.$ext);
unlink($output.'.'.$ext);

}
```
**Note:**

To use the example above you must copy the sample files located at:

**\vendor\lavela\phpjasper\src\JasperStarter\examples\CancelAck.jrxml**
and
**\vendor\lavela\phpjasper\src\JasperStarter\examples\CancelAck.xml**
to folder:
**\public\report**


###MySQL

We ship the [MySQL connector](http://dev.mysql.com/downloads/connector/j/) (v5.1.34) in the `/src/JasperStarter/jdbc/` directory.
Expand Down
0