Skip to content

Commit afcec7b

Browse files
author
geekcom
committed
Update README.md
1 parent e873868 commit afcec7b

File tree

1 file changed

+94
-67
lines changed

1 file changed

+94
-67
lines changed

README.md

Lines changed: 94 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,5 @@
11
# JasperReports for PHP
22

3-
Package to generate reports with [JasperReports 6](http://community.jaspersoft.com/project/jasperreports-library) library through [JasperStarter v3](http://jasperstarter.sourceforge.net/) command-line tool.
4-
5-
##Install
6-
7-
Install [Composer](http://getcomposer.org) if you don't have it.
8-
```
9-
composer require lavela/phpjasper
10-
```
11-
Or in your 'composer.json' file add:
12-
13-
```javascript
14-
{
15-
"require": {
16-
"lavela/phpjasper": "1.0",
17-
}
18-
}
19-
```
20-
21-
And the just run:
22-
23-
composer install
24-
25-
and thats it.
26-
273
##Introduction
284

295
This package aims to be a solution to compile and process JasperReports (.jrxml & .jasper files).
@@ -44,14 +20,69 @@ Well, everything. JasperReports is a powerful tool for **reporting** and **BI**.
4420

4521
> The JasperReports Library is the world's most popular open source reporting engine. It is entirely written in Java and it is able to use data coming from any kind of data source and produce pixel-perfect documents that can be viewed, printed or exported in a variety of document formats including HTML, PDF, Excel, OpenOffice and Word.
4622
47-
I recommend using [Jaspersoft Studio](http://community.jaspersoft.com/project/jaspersoft-studio) to build your reports, connect it to your datasource (ex: MySQL), loop thru the results and output it to PDF, XLS, DOC, RTF, ODF, etc.
23+
I recommend using [Jaspersoft Studio](http://community.jaspersoft.com/project/jaspersoft-studio) to build your reports, connect it to your datasource (ex: MySQL, POSTGRES), loop thru the results and output it to PDF, XLS, DOC, RTF, ODF, etc.
4824

4925
*Some examples of what you can do:*
5026

5127
* Invoices
5228
* Reports
5329
* Listings
5430

31+
Package to generate reports with [JasperReports 6](http://community.jaspersoft.com/project/jasperreports-library) library through [JasperStarter v3](http://jasperstarter.sourceforge.net/) command-line tool.
32+
33+
##Requirements
34+
35+
* Java JDK 1.8
36+
* PHP [exec()](http://php.net/manual/function.exec.php) function
37+
* [optional] [Mysql Connector](http://dev.mysql.com/downloads/connector/j/) (if you want to use database)
38+
* [optional] [PostgreSQL Connector](https://jdbc.postgresql.org/download.html) (if you want to use database)
39+
* [optional] [Jaspersoft Studio](http://community.jaspersoft.com/project/jaspersoft-studio) (to draw and compile your reports)
40+
41+
##Installation
42+
43+
###Java
44+
45+
Check if you already have Java installed:
46+
47+
```
48+
$ java -version
49+
java version "1.8.0_65"
50+
Java(TM) SE Runtime Environment (build 1.8.0_65-b17)
51+
Java HotSpot(TM) Client VM (build 25.65-b01, mixed mode, sharing)
52+
```
53+
54+
If you get:
55+
56+
command not found: java
57+
58+
Then install it with: (Ubuntu/Debian)
59+
60+
$ sudo apt-get install default-jdk
61+
62+
Now run the `java -version` again and check if the output is ok.
63+
64+
##Install
65+
66+
Install [Composer](http://getcomposer.org) if you don't have it.
67+
```
68+
composer require lavela/phpjasper
69+
```
70+
Or in your 'composer.json' file add:
71+
72+
```javascript
73+
{
74+
"require": {
75+
"lavela/phpjasper": "1.0",
76+
}
77+
}
78+
```
79+
80+
And the just run:
81+
82+
composer install
83+
84+
and thats it.
85+
5586
##Examples
5687

5788
###The *Hello World* example.
@@ -79,8 +110,6 @@ $jasper->compile($input)->execute();
79110

80111
This commando will compile the `hello_world.jrxml` source file to a `hello_world.jasper` file.
81112

82-
**Note:** If you are using Laravel 4 run `php artisan tinker` and copy & paste the command above.
83-
84113
####Processing
85114

86115
Now lets process the report that we compile before:
@@ -155,59 +184,56 @@ $jasper->process(
155184
)->execute();
156185
```
157186

158-
##Requirements
159-
160-
* Java JDK 1.8
161-
* PHP [exec()](http://php.net/manual/function.exec.php) function
162-
* [optional] [Mysql Connector](http://dev.mysql.com/downloads/connector/j/) (if you want to use database)
163-
* [optional] [PostgreSQL Connector](https://jdbc.postgresql.org/download.html) (if you want to use database)
164-
* [optional] [Jaspersoft Studio](http://community.jaspersoft.com/project/jaspersoft-studio) (to draw and compile your reports)
165-
166-
167-
##Installation
168-
169-
###Java
170187

171-
Check if you already have Java installed:
188+
###Using in Laravel 5.1!
172189

190+
1. Install [Composer](http://getcomposer.org) if you don't have it.
173191
```
174-
$ java -version
175-
java version "1.8.0_65"
176-
Java(TM) SE Runtime Environment (build 1.8.0_65-b17)
177-
Java HotSpot(TM) Client VM (build 25.65-b01, mixed mode, sharing)
192+
composer require lavela/phpjasper
178193
```
194+
Or in your 'composer.json' file add:
179195

180-
If you get:
181-
182-
command not found: java
196+
```javascript
197+
{
198+
"require": {
199+
"lavela/phpjasper": "1.0",
200+
}
201+
}
202+
```
203+
2. And the just run:
183204

184-
Then install it with: (Ubuntu/Debian)
205+
composer update
185206

186-
$ sudo apt-get install default-jdk
207+
3. Add to your config/app.php providers array:
187208

188-
Now run the `java -version` again and check if the output is ok.
209+
'JasperPHP\JasperPHPServiceProvider',
189210

190-
###Using in Laravel 5.1!
211+
and thats it.
191212

192213
```php
193214
use JasperPHP\JasperPHP as JasperPHP;
194215

195216
Route::get('/', function () {
196217

197-
$input = __DIR__ . '/vendor/lavela/phpjasper/examples/hello_world.jrxml';
198-
$output = __DIR__;
199-
200-
$jasper = new JasperPHP;
201-
202-
// Process a Jasper file to PDF and RTF (you can use directly the .jrxml)
203-
$jasper->process(
204-
$input,
205-
$output,
206-
array("pdf", "rtf")
207-
)->execute();
208-
209-
return view('index');
218+
$output = public_path() . '/report/'.time().'_report.pdf';
219+
$report = new JasperPHP;
220+
$report->process(
221+
public_path() . '/report/report.jrxml',
222+
$output,
223+
array('pdf'),
224+
array(),
225+
array(
226+
'driver' => 'postgres',
227+
'username' => 'username',
228+
'password' => 'password',
229+
'host' => 'localhost',
230+
'database' => 'database',
231+
'port' => '5432',
232+
)
233+
)->execute();
210234
});
235+
```
236+
211237

212238
###MySQL
213239

@@ -229,9 +255,10 @@ Thanks to [Cenote GmbH](http://www.cenote.de/) for the [JasperStarter](http://ja
229255

230256
##Questions?
231257

232-
Drop me a line on Skype [leandro.bittencourt16]
233-
Drop me a line on Skype [danielrodrigueslima]
258+
Drop me a line on Skype [leandro.bittencourt16] or E-Mail [leandrocintrabitencourt@gmail.com]
259+
Drop me a line on Skype [danielrodrigueslima] or E-Mail [danielrodrigues-ti@hotmail.com]
260+
Drop me a line on E-Mail [jefferson.barreto@outlook.com]
234261

235262
##License
236263

237-
MIT
264+
MIT

0 commit comments

Comments
 (0)