Skip to content
This repository has been archived by the owner on May 14, 2024. It is now read-only.
/ php-adf-builder Public archive

A library that simplifies building documents that follow the Atlassian Document Format structure.

License

Notifications You must be signed in to change notification settings

jmsfwk/php-adf-builder

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Atlassian Document Format Builder (PHP)

A library that simplifies building documents that follow the Atlassian Document Format structure.

This is based on pyadf (Python) and adf-builder (JavaScript).

Installation

Install the package using

composer require jmsfwk/adf-builder

Usage

use Jmsfwk\Adf\Document;

$doc = new Document();
$doc->paragraph()
    ->text('See the ')
    ->link('documention', 'https://example.com')
    ->text(' ')
    ->emoji('smile');

Serialization

A document can be serialized in different ways:

$doc = new Document();
$doc->toJson();      // Returns a compact JSON string
json_encode($doc); // Equivalent to '$doc->toString()'

Examples

Simple paragraphs

In order to get an output like:

Hello @joe, please carefully read this contract

You would use:

use Jmsfwk\Adf\Document;

$doc = new Document();
$doc->paragraph()
    ->text('Hello ')
    ->mention($id, 'joe')
    ->text(', please ')
    ->em('carefully')
    ->text(' read ')
    ->link('this contract', 'https://www.example.com/contract');

About

A library that simplifies building documents that follow the Atlassian Document Format structure.

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Languages