PHP code example of marslankhalid / fbr-ims-laravel
1. Go to this page and download the library: Download marslankhalid/fbr-ims-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/ */
marslankhalid / fbr-ims-laravel example snippets
use MarslanKhalid\FbrIms\Contracts\Client;
$response = app(Client::class)->post([
'InvoiceNumber' => '',
'POSID' => 110014,
'USIN' => 'USIN0',
'DateTime' => '2026-07-20 12:00:00',
'BuyerName' => 'Buyer Name',
'BuyerPhoneNumber' => '03001234567',
'TotalBillAmount' => 117,
'TotalQuantity' => 1,
'TotalSaleValue' => 100,
'TotalTaxCharged' => 17,
'Discount' => 0,
'FurtherTax' => 0,
'PaymentMode' => 1,
'RefUSIN' => null,
'InvoiceType' => 1,
'Items' => [[
'ItemCode' => 'IT_1011',
'ItemName' => 'Test Item',
'PCTCode' => '11001010',
'Quantity' => 1,
'TaxRate' => 17,
'SaleValue' => 100,
'Discount' => 0,
'TaxCharged' => 17,
'FurtherTax' => 0,
'TotalAmount' => 117,
'InvoiceType' => 1,
'RefUSIN' => null,
]],
]);
if ($response->successful()) {
$invoiceNumber = $response->invoiceNumber;
} else {
report("FBR error {$response->code}: {$response->message} {$response->description}");
}
use MarslanKhalid\FbrIms\Data\Invoice;
use MarslanKhalid\FbrIms\Data\InvoiceItem;
use MarslanKhalid\FbrIms\Facades\FbrIms;
$item = new InvoiceItem(
itemCode: 'IT_1011',
itemName: 'Test Item',
pctCode: '11001010',
quantity: 1,
taxRate: 17,
saleValue: 100,
discount: 0,
taxCharged: 17,
totalAmount: 117,
);
$invoice = new Invoice(
posId: 110014,
usin: 'USIN0',
dateTime: now(),
totalBillAmount: 117,
totalQuantity: 1,
totalSaleValue: 100,
totalTaxCharged: 17,
items: [$item],
);
$response = FbrIms::post($invoice);