PHPackages                             prexview/prexview - 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 &amp; Document Generation](/categories/documents)
4. /
5. prexview/prexview

ActiveLibrary[PDF &amp; Document Generation](/categories/documents)

prexview/prexview
=================

A composer library to use PrexView, a fast, scalable and friendly service for programatic HTML, PDF, PNG or JPG generation using JSON or XML data.

v1.1.0(8y ago)59891MITPHP

Since Mar 31Pushed 8y ago2 watchersCompare

[ Source](https://github.com/prexview/prexview-php)[ Packagist](https://packagist.org/packages/prexview/prexview)[ RSS](/packages/prexview-prexview/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependencies (1)Versions (3)Used By (0)

[![PrexView](https://camo.githubusercontent.com/0f3fcffdb334689f3580b9133ecb9a058411ae39c4857b8ceae82ea618cece73/68747470733a2f2f70726578766965772e636f6d2f6d656469612f657874656e73696f6e2f70726f6d6f2e706e67)](https://camo.githubusercontent.com/0f3fcffdb334689f3580b9133ecb9a058411ae39c4857b8ceae82ea618cece73/68747470733a2f2f70726578766965772e636f6d2f6d656469612f657874656e73696f6e2f70726f6d6f2e706e67)
=================================================================================================================================================================================================================================================================================================================================================================================================================

[](#)

[![Status](https://camo.githubusercontent.com/e54d480ccef4224a38c156f8736017a817577d8dd6d75cb024afb1a8418473d2/68747470733a2f2f7472617669732d63692e6f72672f70726578766965772f70726578766965772d7068702e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/prexview/prexview-php)

A composer library to use [PrexView](https://prexview.com), a fast, scalable and friendly service for programatic HTML, PDF, PNG or JPG generation using JSON or XML data.

*See [PrexView](https://prexview.com) for more information about the service.*

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

[](#installation)

#### Composer

[](#composer)

```
php composer.phar require prexview/prexview

```

#### Manually

[](#manually)

```
git clone https://github.com/prexview/prexview-php.git vendor/prexview

```

Getting started
---------------

[](#getting-started)

#### Get your API Key

[](#get-your-api-key)

You can get an API Key from [PrexView](https://prexview.com)

#### Set up your API Key

[](#set-up-your-api-key)

If you can setup enviroment variables

```
export PXV_API_KEY="YOUR_API_KEY"

```

If you can't setup environment variables, create the PrexView object with your API Key as argument

```
$pxv = new PrexView\PrexView('YOUR_API_KEY');
```

#### Include the library

[](#include-the-library)

##### Composer installation

[](#composer-installation)

```
require __DIR__  . '/vendor/autoload.php';
```

##### Manual installation

[](#manual-installation)

```
require __DIR__  . '/vendor/prexview/src/PrexView.php';
```

#### Sending an XML

[](#sending-an-xml)

To send an XML string use `$pxv->sendXML($xml, $options)` method, this method will return a [Response object](#response-object) on success or thrown an error.

##### Example

[](#example)

```
$pxv = new Prexview\Prexview();

$options =  new stdClass();

$options->template = 'supported_languages';
$options->output = 'pdf';

$xml = '

  English
  Español
  Française
';

$file = 'test.pdf';

try {
  $res = $pxv->sendXML($xml, $options);

  file_put_contents($file, $res->file);

  echo 'File created: ' . $file;
} catch (Exception $e) {
  die($e->getMessage());
}
```

#### Sending a JSON

[](#sending-a-json)

To send a JSON string or PHP standard object use `$pxv->sendJSON($json, $options)` method, this method will return a [Response object](#response-object) on success or thrown an error.

##### Example

[](#example-1)

```
$pxv = new Prexview\Prexview();

$options =  new stdClass();

$options->template = 'supported_languages';
$options->output = 'pdf';

$json = new StdClass();

$en = new StdClass();
$es = new StdClass();
$fr = new StdClass();

$en->code = 'en';
$en->name = 'English';

$es->code = 'es';
$es->name = 'Español';

$fr->code = 'fr';
$fr->name = 'Française';

$json->languages = [$en, $es, $fr];

$file = 'test.pdf';

try {
  $res = $pxv->sendJSON($json, $options);

  file_put_contents($file, $res->file);

  echo 'File created: ' . $file;
} catch (Exception $e) {
  die($e->getMessage());
}
```

##### Response object

[](#response-object)

PropertyTypeDescriptionid`string`Transaction ID.file`binary`Document created by the service.responseTime`int`Response time from service.rateLimit`int`Maximum number of calls to the service.rateLimitReset`int`Seconds to reset the rate limit.rateRemaining`int`Number of remaining call to the service.##### Options

[](#options)

NameTypeRequiredDescriptiontemplate`string`YesTemplate's name to be used to document creation, you can use [dynamic values](#dynamic-values).output`string`YesType of document that will be created by PrexView service, it must be **html**, **pdf**, **png** or **jpg**.note`string`NoCustom information to be added to the document's metadata, it's limit up to 500 characters and you can use [dynamic values](#dynamic-values).format`string`NoType of data used to the document creation, it must be **xml** or **json**, this should be inferred from library methods.templateBackup`string`NoTemplate's name to use to be used if the option **template** is not available in the service.##### Dynamic values

[](#dynamic-values)

In **template** or **note** options you can use JSON sintax to access data and have dynamic values, for instance having the following JSON data:

```
{
  "Data": {
    "customer": "123"
  }
}
```

Your **template** or **note** can use any data attribute or text node, for instance:

```
'invoice-customer-{{Data.customer}}'

```

Then we will translate that to the following:

```
'invoice-customer-123'

```

And finally the service will try to find the **template** or **note** `invoice-customer-123` in order to transform the data and generate the document.

License
-------

[](#license)

MIT © [PrexView](https://prexview.com)

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 75% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~118 days

Total

2

Last Release

3213d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/ac697a74481387ba4fe14c30231f5e9a0bfbae0c1fc8f4648e9b2499f9602630?d=identicon)[prexview](/maintainers/prexview)

![](https://www.gravatar.com/avatar/7a2cbc43613d0fb6d015b50d24f387823a235818342cca39ef5895c442b07e3a?d=identicon)[sanosom](/maintainers/sanosom)

---

Top Contributors

[![sanosom](https://avatars.githubusercontent.com/u/1503510?v=4)](https://github.com/sanosom "sanosom (15 commits)")[![danioso](https://avatars.githubusercontent.com/u/1430937?v=4)](https://github.com/danioso "danioso (5 commits)")

---

Tags

convertconverterdocument-conversionjsonjson-parserjson-to-htmljson-to-pdfjson-to-pngpdfprexviewtransformxmlxml-parserxml-to-htmlxml-to-pdfxml-to-png

### Embed Badge

![Health badge](/badges/prexview-prexview/health.svg)

```
[![Health](https://phpackages.com/badges/prexview-prexview/health.svg)](https://phpackages.com/packages/prexview-prexview)
```

###  Alternatives

[phpoffice/phpspreadsheet

PHPSpreadsheet - Read, Create and Write Spreadsheet documents in PHP - Spreadsheet engine

13.9k293.5M1.3k](/packages/phpoffice-phpspreadsheet)[spatie/browsershot

Convert a webpage to an image or pdf using headless Chrome

5.2k32.1M102](/packages/spatie-browsershot)[smalot/pdfparser

Pdf parser library. Can read and extract information from pdf file.

2.7k34.5M216](/packages/smalot-pdfparser)[barryvdh/laravel-snappy

Snappy PDF/Image for Laravel

2.8k24.8M48](/packages/barryvdh-laravel-snappy)[openspout/openspout

PHP Library to read and write spreadsheet files (CSV, XLSX and ODS), in a fast and scalable way

1.1k57.6M131](/packages/openspout-openspout)[keboola/csv

Keboola CSV reader and writer

1451.8M21](/packages/keboola-csv)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
