Skip to content

FUNBREW/funbrew-pdf-php

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

FUNBREW PDF PHP SDK

Official PHP client library for the FUNBREW PDF API.

日本語ドキュメント

Installation

composer require funbrew/pdf-php

Quick Start

use Funbrew\Pdf\FunbrewPdf;

$pdf = new FunbrewPdf('sk-your-api-key');

// HTML to PDF
$result = $pdf->fromHtml('<h1>Hello World</h1>');
echo $result['data']['download_url'];

// URL to PDF
$result = $pdf->fromUrl('https://example.com');

// Template to PDF
$result = $pdf->fromTemplate('invoice', [
    'company_name' => 'Acme Inc.',
    'amount' => '1,000',
]);

Features

// Generate PDF and send via email
$result = $pdf->fromHtmlWithEmail(
    '<h1>Invoice</h1>',
    'customer@example.com',
    'Your invoice is ready',
);

// Test mode (no count, TEST watermark)
$result = $pdf->test('<h1>Test</h1>');

// File operations
$info = $pdf->info('uuid.pdf');
$content = $pdf->download('uuid.pdf');
file_put_contents('output.pdf', $content);
$pdf->delete('uuid.pdf');

// Usage stats
$usage = $pdf->usage();

Options

$result = $pdf->fromHtml('<h1>Hello</h1>', [
    'options' => ['page-size' => 'A3'],
    'expiration_hours' => 168,
    'max_downloads' => 5,
    'password' => 'secret',
    'watermark' => 'CONFIDENTIAL',
]);

Error Handling

use Funbrew\Pdf\FunbrewException;

try {
    $result = $pdf->fromHtml('<h1>Hello</h1>');
} catch (FunbrewException $e) {
    echo $e->getMessage();  // Error message
    echo $e->getCode();     // HTTP status code
}

License

MIT

About

Official PHP SDK for FUNBREW PDF API

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages