2017 © Pedro Peláez
 

library adf-builder

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

image

jmsfwk/adf-builder

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

  • Friday, March 23, 2018
  • by jmsfwk
  • Repository
  • 1 Watchers
  • 1 Stars
  • 3 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Atlassian Document Format Builder (PHP)

A library that simplifies building documents that follow the Atlassian Document Format structure., (*1)

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

Installation

Install the package using, (*3)

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:, (*4)

$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:, (*5)

Hello @joe, please carefully read this contract, (*6)

You would use:, (*7)

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');

The Versions

23/03 2018

dev-master

9999999-dev

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

  Sources   Download

MIT

The Requires

  • php ^7.0

 

The Development Requires

by James Fenwick