blazingdocs/blazingdocs-php

v1.0.0 2021-08-21 08:20 UTC

This package is auto-updated.

Last update: 2024-09-21 17:27:33 UTC


README

高性能文档生成API。从CSV、JSON、XML生成文档和报告,99.9%的可用性和24/7的监控。

安装

从终端运行此行

composer require blazingdocs/blazingdocs-php

集成基础

设置

您可以在https://app.blazingdocs.com 获取API密钥

$client = new \BlazingDocs\BlazingClient('API-KEY');

获取账户信息

$account = $client->getAccount();

获取合并模板列表

$templates = $client->getTemplates();

获取使用信息

$usage = $client->getUsage();

执行合并

$client = new \BlazingDocs\BlazingClient('API-KEY');

$parameters = new \BlazingDocs\Parameters\MergeParameters();
$parameters->dataSourceType = \BlazingDocs\Utils\Constants::JSON_TYPE;  # data in json format
$parameters->sequence = false;  # data is object
$parameters->strict = true;  # keep json types

$jsonFile = file_get_contents('PO-Template.json');
$streamFactory = Psr17FactoryDiscovery::findStreamFactory();

$content = $streamFactory->createStreamFromFile('PO-Template.docx', 'r');
$template = new \BlazingDocs\Utils\FormFile('PO-Template.docx', $content);

$data = $client->mergeWithFile($jsonFile, 'output.pdf', $parameters, $template);

文档

更多信息请在此处查看 https://docs.blazingdocs.com