PHP code example of hakanispirli / parasut-laravel

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

    

hakanispirli / parasut-laravel example snippets


use HakanIspirli\ParasutLaravel\Contracts\SalesInvoicesServiceContract;

final readonly class InvoiceController
{
    public function __construct(
        private SalesInvoicesServiceContract $salesInvoices,
    ) {
    }

    public function show(string $invoiceId): array
    {
        return $this->salesInvoices
            ->show(companyId: 123, invoiceId: $invoiceId, 

$result = $salesInvoices->create(
    companyId: 123,
    payload: [
        'data' => [
            'type' => 'sales_invoices',
            'attributes' => [
                'item_type' => 'invoice',
                'issue_date' => '2026-07-01',
                'description' => 'Online sipariş faturası',
            ],
            'relationships' => [
                'contact' => [
                    'data' => ['id' => 'CONTACT_ID', 'type' => 'contacts'],
                ],
                'details' => [
                    'data' => [
                        [
                            'type' => 'sales_invoice_details',
                            'attributes' => [
                                'quantity' => 1,
                                'unit_price' => 100,
                                'vat_rate' => 20,
                            ],
                            'relationships' => [
                                'product' => [
                                    'data' => ['id' => 'PRODUCT_ID', 'type' => 'products'],
                                ],
                            ],
                        ],
                    ],
                ],
            ],
        ],
    ],
    
bash
php artisan vendor:publish --tag=parasut-config