PHP code example of guigralho / afd-generator

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

    

guigralho / afd-generator example snippets


$AfdGenerator = new GuiGralho\AfdGenerator\AfdGenerator([
  'header' => [
    'docEmpregador' => '00.000.000/0000-00',
    'nomeEmpregador' => 'COMPANY LTDA',
    'numRep' => '00000000000000000',
    'dataInicial' => '2020-12-01',
    'dataFinal' => '2020-12-31',
  ],
  'content' => [
    [
      'dataPonto' => '2020-12-01',
      'horarioPonto' => '09:00',
      'numPis' => '123123123',
    ]
  ]
]);

// This returns a string of AFD file
$AfdGenerator->generate();

// This returns a string of AFD file
$AfdGenerator->download($filename = null);