PHP code example of tigamadou / emecef-laravel

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

    

tigamadou / emecef-laravel example snippets


use Emecef\Laravel\Facades\Emecef;

$status = Emecef::getStatusResponse();

use Emecef\Core\Client;

public function __construct(private readonly Client $emecef) {}
// $this->emecef->getStatusResponse(), submitInvoiceRequest(), confirmResponse(), cancelResponse(), etc.

use Emecef\Core\Dto\Request\InvoiceRequestDataDto;
use Emecef\Core\Dto\Request\ItemDto;
use Emecef\Core\Dto\Request\OperatorDto;
use Emecef\Core\Enum\InvoiceType;
use Emecef\Core\Enum\TaxGroupType;
use Emecef\Laravel\Facades\Emecef;

$request = new InvoiceRequestDataDto(
    ifu: '9999900000001',
    type: InvoiceType::FV,
    items: [
        new ItemDto('Article A', 1000, 2.0, TaxGroupType::A),
    ],
    operator: new OperatorDto('Opérateur 1')
);
$response = Emecef::submitInvoiceRequest($request);
if ($response->uid !== null) {
    $security = Emecef::confirmResponse($response->uid);
    // $security->qrCode, $security->codeMECeFDGI for the printed invoice
}
bash
   php artisan vendor:publish --tag=emecef-config
   
bash
   php artisan vendor:publish --tag=emecef-migrations
   php artisan migrate
   
bash
   php artisan vendor:publish --tag=emecef-views