PHPackages                             pdf-api-io/pdfapi-laravel - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. pdf-api-io/pdfapi-laravel

ActiveLibrary

pdf-api-io/pdfapi-laravel
=========================

This is my package pdfapi-laravel

v1.0.0(1y ago)016[4 PRs](https://github.com/pdf-api-io/pdfapi-laravel/pulls)MITPHPPHP ^8.2CI passing

Since Jul 21Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/pdf-api-io/pdfapi-laravel)[ Packagist](https://packagist.org/packages/pdf-api-io/pdfapi-laravel)[ Docs](https://github.com/pdf-api-io/pdfapi-laravel)[ GitHub Sponsors](https://github.com/pdf-api-io)[ RSS](/packages/pdf-api-io-pdfapi-laravel/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (14)Versions (7)Used By (0)

PDF-API.io Laravel integration
==============================

[](#pdf-apiio-laravel-integration)

[![Latest Version on Packagist](https://camo.githubusercontent.com/30f16d2cd87dabbed9ef498901647b72819a92aa80bd6fde746a566f9b3b51dc/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7064662d6170692d696f2f7064666170692d6c61726176656c2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/pdf-api-io/pdfapi-laravel)[![GitHub Tests Action Status](https://camo.githubusercontent.com/bc3ac384b16c9ef1dd32c8c8bc2b9ca3dbf3223137ceaa4764f786b9e6e831c3/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f7064662d6170692d696f2f7064666170692d6c61726176656c2f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/pdf-api-io/pdfapi-laravel/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/ff93adf800ca60120474dd78c22351a885027d13a9c31a0f07febe438def8a3e/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f7064662d6170692d696f2f7064666170692d6c61726176656c2f6669782d7068702d636f64652d7374796c652d6973737565732e796d6c3f6272616e63683d6d61696e266c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/pdf-api-io/pdfapi-laravel/actions?query=workflow%3A%22Fix+PHP+code+style+issues%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/9b8368b0ab41a0da32785adee02ebc06c9079697450922960e9681204340445f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7064662d6170692d696f2f7064666170692d6c61726176656c2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/pdf-api-io/pdfapi-laravel)

This package provides a Laravel integration for [PDF-API.io](https://pdf-api.io). PDF-API.io is a service that allows you to design your PDF templates in a drag-and-drop editor and render them using a simple API.

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require pdf-api-io/pdfapi-laravel
```

You can publish the config file with:

```
php artisan vendor:publish --tag="pdfapi-laravel-config"
```

This is the contents of the published config file:

```
return [
    'api_key' => env('PDF_API_KEY'),
];
```

Create an access token if you don't have one yet. You can do this visiting the [PDF-API.io API token page](https://pdf-api.io/app/api-tokens). Add the following line to your `.env` file:

```
PDF_API_KEY=your-api-key
```

Usage
-----

[](#usage)

You can read the full documentation on the [PDF-API.io website](https://pdf-api.io/en/docs).

### List available templates

[](#list-available-templates)

To list all available templates, you can use the `getTemplates` method on the `PdfApi` facade.

```
use Pdfapiio\PdfapiLaravel\Facades\PdfApi;

$templates = PdfApi::getTemplates();
```

### Render a PDF

[](#render-a-pdf)

To render a PDF, you can use the `render` method.

```
use Pdfapiio\PdfapiLaravel\Facades\PdfApi;

$pdf = PdfApi::render('your-template-id', [
    'some-variable' => 'some-value',
]);

echo $pdf; // Output: "%PDF-1.7 %���� 6 0 obj
