PHP code example of andyfraussen / laravel-dokapi-client

1. Go to this page and download the library: Download andyfraussen/laravel-dokapi-client 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/ */

    

andyfraussen / laravel-dokapi-client example snippets


use AndyFraussen\Dokapi\Facades\Dokapi;

// Send a document with a single call
$response = Dokapi::api()->outgoingDocuments->sendDto($payload, $xml);

echo $response->document->ulid;

use AndyFraussen\Dokapi\Dto\ParticipantIdentifier;
use AndyFraussen\Dokapi\Requests\OutgoingDocumentRequest;

$request = new OutgoingDocumentRequest(
    sender: ParticipantIdentifier::of('0208:0123456789'),
    receiver: ParticipantIdentifier::of('0208:9876543210'),
    c1CountryCode: 'BE',
    documentTypeIdentifier: $docType,
    processIdentifier: $process,
    externalReference: 'inv-2026-001'
);

$response = Dokapi::sendOutgoingDocument($request, $xml);

use AndyFraussen\Dokapi\Facades\Dokapi;

$signature = $request->header('X-Dokapi-Signature');
$secret = config('dokapi.webhook_secret');

$isValid = is_string($signature)
    && is_string($secret)
    && $secret !== ''
    && Dokapi::api()->webhooks->verifySignature($request->getContent(), $signature, $secret);
bash
php artisan vendor:publish --provider="AndyFraussen\Dokapi\DokapiServiceProvider" --tag="dokapi-config"