PHP code example of sharpapi / laravel-invoice-parser
1. Go to this page and download the library: Download sharpapi/laravel-invoice-parser 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/ */
sharpapi / laravel-invoice-parser example snippets
namespace App\Http\Controllers;
use GuzzleHttp\Exception\GuzzleException;
use SharpAPI\InvoiceParser\InvoiceParserService;
class InvoiceController extends Controller
{
protected InvoiceParserService $invoiceParserService;
public function __construct(InvoiceParserService $invoiceParserService)
{
$this->invoiceParserService = $invoiceParserService;
}
/**
* @throws GuzzleException
*/
public function parseInvoice()
{
$statusUrl = $this->invoiceParserService->parseInvoice(
'/path/to/invoice.pdf'
);
$result = $this->invoiceParserService->fetchResults($statusUrl);
return response()->json($result->getResultJson());
}
}