PHP code example of gdinko / pdfmatrix-sdk

1. Go to this page and download the library: Download gdinko/pdfmatrix-sdk library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

gdinko / pdfmatrix-sdk example snippets


use Gdinko\PdfMatrix\Facades\PdfMatrix;

$me = PdfMatrix::me();

dd($me);

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

$me = PdfMatrix::me();

dd($me);

$response = PdfMatrix::listMyFiles();

dd($response);


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());
}


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());
}
bash
php artisan vendor:publish --tag=pdfmatrix-config