LaravelPackages.net
Acme Inc.
Toggle sidebar
gdinko/pdfmatrix-sdk

pdfMatrix Laravel SDK

6.370
0
v1.0.0
About gdinko/pdfmatrix-sdk

gdinko/pdfmatrix-sdk is a Laravel package for pdfmatrix laravel sdk. It currently has 0 GitHub stars and 6.370 downloads on Packagist (latest version v1.0.0). Install it with composer require gdinko/pdfmatrix-sdk. Discover more Laravel packages by gdinko or browse all Laravel packages to compare alternatives.

Last updated

pdfMatrix Laravel SDK

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

pdfmatrix.com JSON API Documentation

Installation

You can install the package via composer:

composer require gdinko/pdfmatrix-sdk

If you need to export configuration file:

php artisan vendor:publish --tag=pdfmatrix-config

Configuration

Add this to .env file:

PDFMATRIX_API_TOKEN= #Get API token from pdfmatrix.com

Usage

use Gdinko\PdfMatrix\Facades\PdfMatrix;

$me = PdfMatrix::me();

dd($me);

Methods

use Gdinko\PdfMatrix\Facades\PdfMatrix;

//Account information
PdfMatrix::me(): array

//PDF Generation
PdfMatrix::pdf(PdfRequestInterface $request)

//PDF Storage
PdfMatrix::listMyFiles(): array
PdfMatrix::getFile($hash): string
PdfMatrix::deleteFile($id): array

Examples

Get information about pdfmatrix API usage

$me = PdfMatrix::me();

dd($me);

List my files stored on pdfmatrix.com cloud

$response = PdfMatrix::listMyFiles();

dd($response);

Generate pdf from url and get JSON response from pdfmatrix.com


use Gdinko\PdfMatrix\Facades\PdfMatrix;
use Gdinko\PdfMatrix\Requests\PdfRequest;
use Gdinko\PdfMatrix\Exceptions\PdfMatrixException;
use Gdinko\PdfMatrix\Exceptions\PdfMatrixValidationException;

try {

    $jsonResponse = PdfMatrix::pdf(
        new PdfRequest([
            'url' => 'https://pdfmatrix.com',
        ])
    );

    dd($jsonResponse);

} catch (PdfMatrixException $e) {
    echo $e->getCode() . '<br />';
    echo $e->getMessage() . '<br />';
    print_r($e->getErrors());
} catch (PdfMatrixValidationException $ve) {
    echo $ve->getCode() . '<br />';
    echo $ve->getMessage() . '<br />';
    print_r($ve->getErrors());
}

Generate pdf from url and send it for download to the browser


use Gdinko\PdfMatrix\Facades\PdfMatrix;
use Gdinko\PdfMatrix\Requests\PdfRequest;
use Gdinko\PdfMatrix\Exceptions\PdfMatrixException;
use Gdinko\PdfMatrix\Exceptions\PdfMatrixValidationException;

try {

    return PdfMatrix::pdf(
        new PdfRequest([
            'url' => 'https://pdfmatrix.com',
            'return' => 'download'
        ])
    );

} catch (PdfMatrixException $e) {
    echo $e->getCode() . '<br />';
    echo $e->getMessage() . '<br />';
    print_r($e->getErrors());
} catch (PdfMatrixValidationException $ve) {
    echo $ve->getCode() . '<br />';
    echo $ve->getMessage() . '<br />';
    print_r($ve->getErrors());
}

Testing

composer test

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email [email protected] instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.

Comments