PHP code example of hamza-rico / laravel-pingen-letter

1. Go to this page and download the library: Download hamza-rico/laravel-pingen-letter 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/ */

    

hamza-rico / laravel-pingen-letter example snippets


use HamzaRico\PingenLetter\Facades\PingenLetter;
use HamzaRico\PingenLetter\DTO\Recipient;
use HamzaRico\PingenLetter\Enums\DeliveryProduct;

$letter = PingenLetter::to(new Recipient(
        name:    'Jane Doe',
        street:  'Musterstrasse 12',
        zip:     '10115',
        city:    'Berlin',
        country: 'DE',
    ))
    ->documents([
        'https://example.com/translation.pdf',
        storage_path('app/certificate.pdf'),
    ])
    ->deliveryProduct(DeliveryProduct::Cheap)
    ->color()
    ->duplex()
    ->send();

// ['id' => '…', 'url' => 'https://app.pingen.com/…', 'status' => 'sent', 'pages' => 3]

$pdf = PingenLetter::to($recipient)
    ->documents([$path])
    ->build(); // ['path' => '/tmp/…​.pdf', 'pages' => 2]

$client = PingenLetter::client();
$client->getLetter($id);       // status + tracking
$client->cancelLetter($id);    // cancel (only while submitted / print preparation)
$client->calculatePrice([...]); // price for a country + options