PHP code example of sgrigorjev / adf-tools

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

    

sgrigorjev / adf-tools example snippets


$document = (new Document())
    ->bulletlist()
        ->item()
            ->paragraph()
                ->text('item 1')
            ->end()
        ->end()
        ->item()
            ->paragraph()
                ->text('item 2')
            ->end()
        ->end()
    ->end()
;

$document = (new Document())
    ->append(
        (new BulletList())
            ->append(
                (new ListItem())
                    ->append(
                        (new Paragraph())
                            ->append(new Text('item 1'))
                    ),
                (new ListItem())
                    ->append(
                        (new Paragraph())
                            ->append(new Text('item 2'))
                    )
                    
            )
    )
;

$paragraph = (new Paragraph())->append(new Text('Line 1'));

if (some condition) {
    $paragraph->append(new Text('(doc)', new Link('https://example.com/doc')));
}

$document = (new Document())->append($paragraph);

$document = (new Document())
    ->extension(
        'default',
        'com.atlassian.confluence.macro.core',
        'toc',
        [
            "macroParams" => [
                "maxLevel" => [
                    "value" => "3"
                ],
                "minLevel" => [
                    "value" => "1"
                ],
                "outline" => [
                    "value" => "false"
                ],
                "printable" => [
                    "value" => "false"
                ],
                "type" => [
                    "value" => "list"
                ]
            ]
        ],
        '123cad9c-95d8-49df-8b99-00886ba0af5d',
    )
;

$document = (new Document())
    ->append(
        new Extension(
            'default',
            'com.atlassian.confluence.macro.core',
            'toc',
            [
                "macroParams" => [
                    "maxLevel" => [
                        "value" => "3"
                    ],
                    "minLevel" => [
                        "value" => "1"
                    ],
                    "outline" => [
                        "value" => "false"
                    ],
                    "printable" => [
                        "value" => "false"
                    ],
                    "type" => [
                        "value" => "list"
                    ]
                ]
            ],
            '123cad9c-95d8-49df-8b99-00886ba0af5d',
        )
    )
;