11# Reports for PHP and Laravel 5.* , with JasperReports.
22
3- [ ![ 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 )
3+ [ ![ Latest Stable Version] ( https://poser.pugx.org/geekcom/phpjasper/v/stable )] ( https://packagist.org/packages/geekcom/phpjasper )
4+ [ ![ License] ( https://poser.pugx.org/geekcom/phpjasper/license )] ( https://packagist.org/packages/geekcom/phpjasper ) [ ![ Total Downloads] ( https://poser.pugx.org/geekcom/phpjasper/downloads )] ( https://packagist.org/packages/geekcom/phpjasper )
45
56** Is using Linux servers?**
67
7- Do not forget to grant permission 777 for the directory ** /vendor/lavela /phpjasper/src/JasperStarter/bin** and the file binary ** jasperstarter**
8+ Do not forget to grant permission 777 for the directory ** /vendor/geekcom /phpjasper/src/JasperStarter/bin** and the file binary ** jasperstarter**
89
910##Introduction
1011
@@ -84,14 +85,14 @@ Now run the `java -version` again and check if the output is ok.
8485
85862 . Install [ Composer] ( http://getcomposer.org ) if you don't have it.
8687```
87- composer require lavela /phpjasper
88+ composer require geekcom /phpjasper
8889```
8990Or in your 'composer.json' file add:
9091
9192``` javascript
9293{
9394 " require" : {
94- " lavela /phpjasper" : " 1.*"
95+ " geekcom /phpjasper" : " 1.*"
9596 }
9697}
9798```
@@ -106,7 +107,7 @@ and thats it.
106107
107108###The * Hello World* example.
108109
109- Go to the examples directory in the root of the repository (` vendor/lavela /phpjasper/examples ` ).
110+ Go to the examples directory in the root of the repository (` vendor/geekcom /phpjasper/examples ` ).
110111Open the ` hello_world.jrxml ` file with Jaspersoft Studio or with your favorite text editor and take a look at the source code.
111112
112113#### Compiling
@@ -121,7 +122,7 @@ require __DIR__ . '/vendor/autoload.php';
121122
122123use JasperPHP\JasperPHP;
123124
124- $input = __DIR__ . '/vendor/lavela /phpjasper/examples/hello_world.jrxml';
125+ $input = __DIR__ . '/vendor/geekcom /phpjasper/examples/hello_world.jrxml';
125126
126127$jasper = new JasperPHP;
127128$jasper->compile($input)->execute();
@@ -139,8 +140,8 @@ require __DIR__ . '/vendor/autoload.php';
139140
140141use JasperPHP\JasperPHP;
141142
142- $input = __DIR__ . '/vendor/lavela /phpjasper/examples/hello_world.jasper';
143- $output = __DIR__ . '/vendor/lavela /phpjasper/examples';
143+ $input = __DIR__ . '/vendor/geekcom /phpjasper/examples/hello_world.jasper';
144+ $output = __DIR__ . '/vendor/geekcom /phpjasper/examples';
144145
145146$jasper = new JasperPHP;
146147
@@ -165,7 +166,7 @@ require __DIR__ . '/vendor/autoload.php';
165166
166167use JasperPHP\JasperPHP;
167168
168- $input = __DIR__ . '/vendor/lavela /phpjasper/examples/hello_world_params.jrxml';
169+ $input = __DIR__ . '/vendor/geekcom /phpjasper/examples/hello_world_params.jrxml';
169170
170171$jasper = new JasperPHP;
171172$output = $jasper->list_parameters($input)->execute();
@@ -184,37 +185,50 @@ require __DIR__ . '/vendor/autoload.php';
184185
185186use JasperPHP\JasperPHP;
186187
187- $input = __DIR__ . '/vendor/lavela/phpjasper/examples/hello_world.jrxml';
188- $output = __DIR__ . '/vendor/lavela/phpjasper/examples';
188+ $input = __DIR__ . '/vendor/geekcom/phpjasper/examples/hello_world.jrxml';
189+ $output = __DIR__ . '/vendor/geekcom/phpjasper/examples';
190+
191+ private $conn;
192+
193+ public function __construct()
194+ {
195+ $this->conn = [
196+ 'driver' => 'postgres',
197+ 'username' => 'DB_USERNAME',
198+ 'password' => 'DB_PASSWORD',
199+ 'host' => 'DB_HOST',
200+ 'database' => 'DB_DATABASE',
201+ 'schema' => 'DB_SCHEMA',
202+ 'port' => '5432'
203+ ];
204+ }
189205
190206$jasper = new JasperPHP;
207+
191208$jasper->process(
192- $input,
193- $output,
194- array("pdf", "rtf"),
195- array("php_version" => phpversion()),
196- array(
197- 'driver' => 'postgres',
198- 'username' => 'vagrant',
199- 'host' => 'localhost',
200- 'database' => 'samples',
201- 'port' => '5432',
202- )
209+ $input,
210+ $output,
211+ array("pdf", "rtf"),
212+ array("php_version" => phpversion()),
213+ $this->conn,
214+ true,
215+ true,
216+ 'pt_BR' //LOCALE
203217)->execute();
204218```
205219
206220###Using JasperPHP with Laravel 5.*
207221
2082221 . Install [ Composer] ( http://getcomposer.org ) if you don't have it.
209223```
210- composer require lavela /phpjasper
224+ composer require geekcom /phpjasper
211225```
212226Or in your 'composer.json' file add:
213227
214228``` javascript
215229{
216230 " require" : {
217- " lavela /phpjasper" : " 1.*"
231+ " geekcom /phpjasper" : " 1.*"
218232 }
219233}
220234```
@@ -228,7 +242,7 @@ Or in your 'composer.json' file add:
228242
2292434 . Create a folder ** /report** on ** /public directory**
230244
231- 5 . Copy the file ** hello_world.jrxml** in ** /vendor/lavela /phpjasper/examples** from directory: ** /public/report**
245+ 5 . Copy the file ** hello_world.jrxml** in ** /vendor/geekcom /phpjasper/examples** from directory: ** /public/report**
232246
2332476 . Run ** php artisan serve**
234248
@@ -298,9 +312,9 @@ public function xmlToPdf()
298312
299313To use the example above you must copy the sample files located at:
300314
301- ** \vendor\lavela \phpjasper\examples\CancelAck.jrxml**
315+ ** \vendor\geekcom \phpjasper\examples\CancelAck.jrxml**
302316and
303- ** \vendor\lavela \phpjasper\examples\CancelAck.xml**
317+ ** \vendor\geekcom \phpjasper\examples\CancelAck.xml**
304318to folder:
305319** \public\report**
306320
@@ -346,9 +360,9 @@ public function jsonToPdf()
346360
347361To use the example above you must copy the sample files located at:
348362
349- ** \vendor\lavela \phpjasper\examples\json.jrxml**
363+ ** \vendor\geekcom \phpjasper\examples\json.jrxml**
350364and
351- ** \vendor\lavela \phpjasper\examples\contacts.json**
365+ ** \vendor\geekcom \phpjasper\examples\contacts.json**
352366to folder:
353367** \public\report**
354368
0 commit comments