{"id":18385480,"url":"https://github.com/prexview/prexview-php","last_synced_at":"2026-02-12T14:35:28.120Z","repository":{"id":57044551,"uuid":"78685324","full_name":"prexview/prexview-php","owner":"prexview","description":"Transform your data from XML or JSON to high quality, beautiful and readable documents in PDF, HTML, PNG or JPG.","archived":false,"fork":false,"pushed_at":"2017-07-28T01:24:43.000Z","size":17,"stargazers_count":5,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-11-27T16:23:51.400Z","etag":null,"topics":["convert","converter","document-conversion","json","json-parser","json-to-html","json-to-pdf","json-to-png","pdf","prexview","transform","xml","xml-parser","xml-to-html","xml-to-pdf","xml-to-png"],"latest_commit_sha":null,"homepage":"https://prexview.com","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/prexview.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-01-11T22:22:20.000Z","updated_at":"2023-07-27T05:47:58.000Z","dependencies_parsed_at":"2022-08-24T04:50:19.952Z","dependency_job_id":null,"html_url":"https://github.com/prexview/prexview-php","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/prexview/prexview-php","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prexview%2Fprexview-php","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prexview%2Fprexview-php/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prexview%2Fprexview-php/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prexview%2Fprexview-php/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/prexview","download_url":"https://codeload.github.com/prexview/prexview-php/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prexview%2Fprexview-php/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29368707,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-12T08:51:36.827Z","status":"ssl_error","status_checked_at":"2026-02-12T08:51:26.849Z","response_time":55,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["convert","converter","document-conversion","json","json-parser","json-to-html","json-to-pdf","json-to-png","pdf","prexview","transform","xml","xml-parser","xml-to-html","xml-to-pdf","xml-to-png"],"created_at":"2024-11-06T01:17:46.457Z","updated_at":"2026-02-12T14:35:28.106Z","avatar_url":"https://github.com/prexview.png","language":"PHP","readme":"# ![PrexView](https://prexview.com/media/extension/promo.png)\n\n[![Status](https://travis-ci.org/prexview/prexview-php.svg?branch=master)](https://travis-ci.org/prexview/prexview-php)\n\nA composer library to use [PrexView][1], a fast, scalable and friendly service for programatic HTML, PDF, PNG or JPG generation using JSON or XML data.\n\n*See [PrexView][1] for more information about the service.*\n\n\n## Installation\n\n#### Composer\n\n```\nphp composer.phar require prexview/prexview\n```\n\n#### Manually\n\n```\ngit clone https://github.com/prexview/prexview-php.git vendor/prexview\n```\n\n## Getting started\n\n#### Get your API Key\n\nYou can get an API Key from [PrexView][1]\n\n#### Set up your API Key\n\nIf you can setup enviroment variables\n\n```\nexport PXV_API_KEY=\"YOUR_API_KEY\"\n```\n\nIf you can't setup environment variables, create the PrexView object with your API Key as argument\n\n```php\n$pxv = new PrexView\\PrexView('YOUR_API_KEY');\n```\n\n#### Include the library\n\n##### Composer installation\n\n```php\nrequire __DIR__  . '/vendor/autoload.php';\n```\n\n##### Manual installation\n\n```php\nrequire __DIR__  . '/vendor/prexview/src/PrexView.php';\n```\n\n#### Sending an XML\n\nTo send an XML string use ```$pxv-\u003esendXML($xml, $options)``` method, this method will return a [Response object][3] on success or thrown an error.\n\n##### Example\n\n```php\n$pxv = new Prexview\\Prexview();\n\n$options =  new stdClass();\n\n$options-\u003etemplate = 'supported_languages';\n$options-\u003eoutput = 'pdf';\n\n$xml = '\u003c?xml version=\"1.0\" encoding=\"UTF-8\"?\u003e\n\u003clanguages\u003e\n  \u003clang code=\"en\"\u003eEnglish\u003c/lang\u003e\n  \u003clang code=\"es\"\u003eEspañol\u003c/lang\u003e\n  \u003clang code=\"fr\"\u003eFrançaise\u003c/lang\u003e\n\u003c/languages\u003e';\n\n$file = 'test.pdf';\n\ntry {\n  $res = $pxv-\u003esendXML($xml, $options);\n\n  file_put_contents($file, $res-\u003efile);\n\n  echo 'File created: ' . $file;\n} catch (Exception $e) {\n  die($e-\u003egetMessage());\n}\n```\n\n#### Sending a JSON\n\nTo send a JSON string or PHP standard object use ```$pxv-\u003esendJSON($json, $options)``` method, this method will return a [Response object][3] on success or thrown an error.\n\n##### Example\n\n```php\n$pxv = new Prexview\\Prexview();\n\n$options =  new stdClass();\n\n$options-\u003etemplate = 'supported_languages';\n$options-\u003eoutput = 'pdf';\n\n$json = new StdClass();\n\n$en = new StdClass();\n$es = new StdClass();\n$fr = new StdClass();\n\n$en-\u003ecode = 'en';\n$en-\u003ename = 'English';\n\n$es-\u003ecode = 'es';\n$es-\u003ename = 'Español';\n\n$fr-\u003ecode = 'fr';\n$fr-\u003ename = 'Française';\n\n$json-\u003elanguages = [$en, $es, $fr];\n\n$file = 'test.pdf';\n\ntry {\n  $res = $pxv-\u003esendJSON($json, $options);\n\n  file_put_contents($file, $res-\u003efile);\n\n  echo 'File created: ' . $file;\n} catch (Exception $e) {\n  die($e-\u003egetMessage());\n}\n```\n\n##### Response object\n\n|Property|Type|Description|\n|--------|:--:|-----------|\n|id|`string`|Transaction ID.|\n|file|`binary`|Document created by the service.|\n|responseTime|`int`|Response time from service.|\n|rateLimit|`int`|Maximum number of calls to the service.|\n|rateLimitReset|`int`|Seconds to reset the rate limit.|\n|rateRemaining|`int`|Number of remaining call to the service.|\n\n##### Options\n\n|Name|Type|Required|Description|\n|----|:--:|:------:|-----------|\n|template|`string`|Yes|Template's name to be used to document creation, you can use [dynamic values][2].|\n|output|`string`|Yes|Type of document that will be created by PrexView service, it must be **html**, **pdf**, **png** or **jpg**.|\n|note|`string`|No|Custom information to be added to the document's metadata, it's limit up to 500 characters and you can use [dynamic values][2].|\n|format|`string`|No|Type of data used to the document creation, it must be **xml** or **json**, this should be inferred from library methods.|\n|templateBackup|`string`|No|Template's name to use to be used if the option **template** is not available in the service.|\n\n##### Dynamic values\n\nIn **template** or **note** options you can use JSON sintax to access data and have dynamic values, for instance having the following JSON data:\n\n```json\n{\n  \"Data\": {\n    \"customer\": \"123\"\n  }\n}\n```\n\nYour **template** or **note** can use any data attribute or text node, for instance:\n\n```\n'invoice-customer-{{Data.customer}}'\n```\n\nThen we will translate that to the following:\n\n```\n'invoice-customer-123'\n```\n\nAnd finally the service will try to find the **template** or **note** ```invoice-customer-123``` in order to transform the data and generate the document.\n\n## License\n\nMIT © [PrexView][1]\n\n[1]: https://prexview.com\n[2]: #dynamic-values\n[3]: #response-object\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprexview%2Fprexview-php","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fprexview%2Fprexview-php","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprexview%2Fprexview-php/lists"}