PHP code example of psys / order-invoice-manager-bundle
1. Go to this page and download the library: Download psys/order-invoice-manager-bundle 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/ */
psys / order-invoice-manager-bundle example snippets
php
namespace App\Lib;
use Doctrine\ORM\EntityManagerInterface;
use Psys\OrderInvoiceManagerBundle\Entity\Order;
use Psys\OrderInvoiceManagerBundle\Model\InvoiceManager\InvoiceManager;
use Symfony\Component\HttpFoundation\Response;
use Twig\Environment;
class MyInvoiceManager extends InvoiceManager
{
public function __construct
(
private Environment $twig,
private EntityManagerInterface $entityManager,
)
{
parent::__construct($entityManager);
}
public function createPDF (Order $order, $type, string $outputMode)
{
$html = $this->twig->render('invoice/index.html.twig',
[
'order' => $order,
'type' => $type,
]);
$mpdf = new \Mpdf\Mpdf();
$mpdf->WriteHTML($html);
if ($outputMode === 'HttpInline')
{
return $mpdf->OutputHttpInline();
}
}
}