Skip to content

Commit 0bf81d6

Browse files
committed
Merge pull request #2 from geekcom/master
New Update README.md
2 parents 732facf + ba75c28 commit 0bf81d6

File tree

1 file changed

+18
-14
lines changed

1 file changed

+18
-14
lines changed

README.md

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -202,37 +202,41 @@ Or in your 'composer.json' file add:
202202
```
203203
2. And the just run:
204204

205-
composer update
205+
**composer update**
206206

207207
3. Add to your config/app.php providers array:
208208

209209
'JasperPHP\JasperPHPServiceProvider',
210210

211-
and thats it.
211+
4. Create a folder **/report** on **/public directory**
212+
213+
5. Copy the file **hello_world.jrxml** in **/vendor/lavela/phpjasper/examples** from directory: **/public/report**
214+
215+
6. Run **php artisan serve**
216+
217+
7. Access **localhost:8000/reports**
218+
219+
8. Check the directory **/public/report**. You now have 3 files, `hello_world.pdf`, `hello_world.rtf` and `hello_world.xml`.
220+
221+
**Below the code you will use in your route.php**
212222

213223
```php
214224
use JasperPHP\JasperPHP as JasperPHP;
215225

216-
Route::get('/', function () {
226+
Route::get('/reports', function () {
217227

218-
$output = public_path() . '/report/'.time().'_report.pdf';
228+
$output = public_path() . '/report/'.time().'_hello_world';
219229
$report = new JasperPHP;
220230
$report->process(
221-
public_path() . '/report/report.jrxml',
231+
public_path() . '/report/hello_world.jrxml',
222232
$output,
223-
array('pdf'),
233+
array('pdf', 'rtf', 'xml'),
224234
array(),
225-
array(
226-
'driver' => 'postgres',
227-
'username' => 'username',
228-
'password' => 'password',
229-
'host' => 'localhost',
230-
'database' => 'database',
231-
'port' => '5432',
232-
)
235+
array()
233236
)->execute();
234237
});
235238
```
239+
In this example we generate reports pdf, rtf and xml.
236240

237241

238242
###MySQL

0 commit comments

Comments
 (0)