PHP code example of mzur / invoiscript

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

    

mzur / invoiscript example snippets


use Mzur\InvoiScript\Invoice;

nvoice No. 1',
   'beforeInfo' => [
      '<b>Date:</b>',
      'June 10, 2021',
   ],
   'afterInfo' => [
      'All prices in EUR.',
      '',
      'This invoice is due on <b>June 20, 2021</b>.',
   ],
   'clientAddress' => [
      'Jane Doe',
      'Example Street 42',
      '1337 Demo City',
   ],
   'entries' => [
      [
         'description' => 'Hot air',
         'quantity' => 11,
         'price' => 8,
      ],
      [
         'description' => 'Something cool',
         'quantity' => 5,
         'price' => 20,
      ],
   ],
];

$pdf = new Invoice($content);
$pdf->generate('invoice.pdf');

$content = [
   'title' => 'Invoice No. <b>1</b>',
   'beforeInfo' => [
      '<i>Date:</i>',
      '<u>June 10, 2021</u>',
   ],
   //...
];

$pdf = new Invoice($content);
$pdf->setTemplate(__DIR__.'/template.pdf');

$pdf = new Invoice($content);
$pdf->setLanguage('de');

$content = [
   'title' => 'Invoice No. {number}',
   'beforeInfo' => [
      '<b>Date:</b>',
      '{createdDate}',
   ],
   //...
];

$variables = [
   'number' => 1,
   'createdDate' => 'June 10, 2021',
];

$pdf = new Invoice($content);
$pdf->setVariables($variables);

$layout = [
   'font' => 'helvetica',
];

$pdf = new Invoice($content);
$pdf->setLayout($layout);