Search by

nb / oxymel

nb

A sweet XML builder

Package info

github.com/nb/oxymel

pkg:composer/nb/oxymel

Statistics

Installs: 9 681 246

Dependents: 2

Suggesters: 0

Stars: 22

Open Issues: 0

v0.1.0 2013-02-24 15:01 UTC

This package is not auto-updated.

Last update: 2026-10-03 07:49:48 UTC


README

$oxymel = new Oxymel;
echo $oxymel
  ->xml
  ->html->contains
    ->head->contains
      ->meta(array('charset' => 'utf-8'))
      ->title("How to seduce dragons")
    ->end
    ->body(array('class' => 'story'))->contains
      ->h1('How to seduce dragons', array('id' => 'begin'))
      ->h2('The fire manual')
      ->p('Once upon a time in a distant land there was an dragon.')
      ->p('In another very distant land')->contains
        ->text(' there was a very ')->strong('strong')->text(' warrrior')
      ->end
      ->p->contains->cdata('who fought bold dragons')->end
      ->raw('

with not fake bold dragons, too

'
) ->tag('dragon:identity', array('name' => 'Jake')) ->comment('no dragons were harmed during the generation of this XML document') ->end ->end ->to_string();

Outputs:

xml version="1.0" encoding="UTF-8"?>
<html>
  <head>
    <meta charset="utf-8"/>
    <title>How to seduce dragonstitle>
  head>
  <body class="story">
    <h1 id="begin">How to seduce dragonsh1>
    <h2>The fire manualh2>
    <p>Once upon a time in a distant land there was an dragon.p>
    <p>In another very distant land there was a very <strong>strongstrong> warrriorp>
    <p>who fought bold dragons]]>p>
    <p>with not fake <b>boldb> dragons, toop>
    <dragon:identity name="Jake"/>
    
  body>
html>