PHP code example of dazi-web / reb-da11

1. Go to this page and download the library: Download dazi-web/reb-da11 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/ */

    

dazi-web / reb-da11 example snippets


use DaziWeb\RebDa11\Calculation;
use DaziWeb\RebDa11\Da11Writer;
use DaziWeb\RebDa11\Header;
use DaziWeb\RebDa11\OzMask;
use DaziWeb\RebDa11\TextLine;

$mask = OzMask::fromLevels([2, 2], positionLength: 4, indexLength: 1); // 1122PPPPI
$oz = $mask->format(['01', '04', '20']);                                 // "01040020 "

$file = (new Da11Writer)->write(new Header('Musterbau Nord, Gebäude A', $mask, '2026-17'), [
    new TextLine($oz, 'Wand Treppenhaus, EG'),
    new Calculation($oz, '5,20*2,60', explanation: 'Wand', factor: '2'),
    new Calculation($oz, '1,20*1,30', explanation: 'Fenster', factor: '2', deduction: true),
]);

file_put_contents('aufmass.d11', $file); // CP850 bytes

use DaziWeb\RebDa11\Da11Reader;

$document = (new Da11Reader)->read(file_get_contents('aufmass.d11'));
// ['header' => [...], 'entries' => [['type' => 'calculation', 'oz' => ..., 'expression' => ..., ...], ...]]