forked from codedge/laravel-fpdf
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
121 changed files
with
12,436 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
composer.lock | ||
/vendor |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
# Laravel 5 package for Fpdf | ||
This repository implements a simple [ServiceProvider](https://laravel.com/docs/master/providers) | ||
that creates a singleton instance of the Fpdf PDF library - easily accessible via a [Facade](https://laravel.com/docs/master/facades) in [Laravel 5](http://laravel.com). | ||
See [@Fpdf](http://www.fpdf.org/) for more information about the usage. | ||
|
||
## Installation using [Composer](https://getcomposer.org/) | ||
```sh | ||
$ cd <YOUR LARAVEL PROJECT ROOT> | ||
$ composer require codedge/laravel-fpdf:"dev-master" | ||
``` | ||
|
||
This adds the codedge/laravel-fpdf package to your `composer.json` and downloads the project. | ||
|
||
Next run | ||
`php artisan vendor:publish --provider="Codedge\Fpdf\FpdfServiceProvider" --tag=config` | ||
to publish the configuration file for the SOFORT API to `config/fpdf.php`. | ||
|
||
**Hint**: Open this file and enter the correct page settings, if you do not want the defaults. | ||
|
||
## Usage | ||
To use the static interfaces (facades) you need to add the following lines to your `config/app.php`. The `[1]` is for | ||
registering the service provider, the `[2]` are for specifying the facades: | ||
|
||
```php | ||
// config/app.php | ||
|
||
return [ | ||
|
||
//... | ||
|
||
'providers' => [ | ||
// ... | ||
|
||
/* | ||
* Application Service Providers... | ||
*/ | ||
App\Providers\AppServiceProvider::class, | ||
App\Providers\AuthServiceProvider::class, | ||
App\Providers\EventServiceProvider::class, | ||
App\Providers\RouteServiceProvider::class, | ||
Codedge\Fpdf\FpdfServiceProvider::class, // [1] | ||
], | ||
|
||
// ... | ||
|
||
'aliases' => [ | ||
'App' => Illuminate\Support\Facades\App::class, | ||
'Artisan' => Illuminate\Support\Facades\Artisan::class, | ||
|
||
// ... | ||
|
||
'View' => Illuminate\Support\Facades\View::class, | ||
'Fpdf' => Codedge\Fpdf\Facades\Fpdf::class, // [2] | ||
|
||
] | ||
``` | ||
|
||
Now you can use the facades in your application. | ||
|
||
## Basic example | ||
|
||
If you want to use the facade you can see a basic example here: | ||
|
||
```php | ||
// app/Http/routes.php | ||
|
||
Route::get('/', function () { | ||
|
||
Fpdf::AddPage(); | ||
Fpdf::SetFont('Courier', 'B', 18); | ||
Fpdf::Cell(50, 25, 'Hello World!'); | ||
Fpdf::Output(); | ||
|
||
}); | ||
``` | ||
|
||
Of course you can also inject the singleton instance via dependency injection. See an example here: | ||
|
||
```php | ||
// app/Http/routes.php | ||
|
||
Route::get('/', function (Codedge\Fpdf\Fpdf\FPDF $fpdf) { | ||
|
||
$fpdf->AddPage(); | ||
$fpdf->SetFont('Courier', 'B', 18); | ||
$fpdf->Cell(50, 25, 'Hello World!'); | ||
$fpdf->Output(); | ||
|
||
}); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
{ | ||
"name": "codedge/laravel-fpdf", | ||
"description" : "Laravel 5 package for use with Fpdf. It ships with Fpdf 1.81.", | ||
"license": "MIT", | ||
"keywords": [ | ||
"fpdf", | ||
"laravel", | ||
"pdf" | ||
], | ||
"authors": [ | ||
{ | ||
"name": "Holger Lösken", | ||
"email": "[email protected]" | ||
} | ||
], | ||
"require": { | ||
"php": ">=5.4.0", | ||
"illuminate/support": "5.*" | ||
}, | ||
"autoload": { | ||
"psr-4": { | ||
"Codedge\\Fpdf\\": "src/" | ||
} | ||
}, | ||
"extra": { | ||
"branch-alias": { | ||
"dev-master": "5.0-dev" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?php namespace Codedge\Fpdf\Facades; | ||
|
||
use Illuminate\Support\Facades\Facade; | ||
|
||
/** | ||
* Class Fpdf | ||
* | ||
* @package Codedge\Fpdf\Facades | ||
*/ | ||
class Fpdf extends Facade | ||
{ | ||
/** | ||
* Get the registered component name | ||
* | ||
* @return string | ||
*/ | ||
protected static function getFacadeAccessor() | ||
{ | ||
return 'fpdf'; | ||
} | ||
} |
Oops, something went wrong.