In development. Not released. Nothing to download or buy.
How it works
How Xonry builds a page
This page follows one request, for the address / of a small demo project, from the folder on disk to the HTML in the browser. Every listing is a real file. Every picture is the real result.
- The folderAll the files of a small demo project, in one tree.
- The requestWhat happens when the browser asks for one address.
- The dashboardThe same files, changed on a screen.
Status. Xonry is in development and not released. You cannot install it yet.
1. The folder
A project is a folder. These are all the files of the demo project.
demo-site/
index.php the front controller, the same file in every project
xonry.json settings: the language of the pages
wireframes.php the pages and their sections
head.php what goes inside <head>
foot.php scripts before </body>
css/site.css
js/xon.min.js
js/app.js
layers/
navigation/navigation.php navigation.css
hero/hero.php hero.css
parts/parts.php parts.css
counter/counter.php counter.css
files/files.php files.css
footer/footer.php footer.css
about/about.php about.css
index.php is the front controller. It is the same file in every project and holds nothing about this one. Everything particular to the site is in the files around it.
2. The request
The browser asks for /. Xonry takes the first part of the path as the route. Here it is empty, so Xonry looks for the page marked 'default' => true. An address such as /about gives the route about. A route with no entry gets a 404 answer, drawn with the project's own page named 404 when it has one.
3. The map: wireframes.php
<?php
# SECURE -----------------
if (!$home) exit;
# WIREFRAMES ------------------- edit in the Xonry dashboard (Wireframes) or by hand;
# one $_WIREFRAMES[route] per page: its sections in order, then the page settings.
# A name starting with "_" is a layout; '@page' marks where the page's sections go.
...$_WIREFRAMES['index'] = array(
array(
'filename' => 'hero',
'tag' => 'section',
'id' => 'top',
'class' => 'hero',
'hasContainer' => 1,
),
array(
'filename' => 'parts',
'tag' => 'section',
'id' => 'parts',
'class' => 'parts',
'hasContainer' => 1,
),
... counter and files: two more sections of the same shape ... 'title' => 'Home',
'default' => true,
);
Each numbered item is one section of the page, in the order it appears. Each has five fields. filename is the section file. tag, id and class describe the element the server wraps around it. hasContainer asks for an inner container: 1 for container, 2 for container-fluid, 0 for none.
The named items after the sections are page settings. 'default' => true makes this the start page.
The file is ordinary PHP that assigns arrays. The engine runs it. Tools that only need to read it do not run it: they read it as data. The API refuses to write a wireframes.php that holds code (the answer is 409). OnceBuilder Studio shows a file it cannot model exactly as code, with a reason, and does not edit it.
4. The layout
$_WIREFRAMES['_layout'] = array(
array(
'filename' => 'navigation',
'tag' => 'header',
'id' => '',
'class' => 'site-header',
'hasContainer' => 1,
),
array(
'filename' => '@page',
),
array(
'filename' => 'footer',
'tag' => 'footer',
'id' => '',
'class' => 'site-footer',
'hasContainer' => 1,
),
);
A name that starts with an underscore is a layout. A layout is never a page of its own. When _layout exists, every page is rendered inside it. The item 'filename' => '@page' marks the place for the page's own sections.
For the address / the result is six sections: navigation, then hero, parts, counter and files from the page, then footer. A page can opt out with 'layout' => false, or name another layout, for example 'layout' => '_plain'. Layouts do not nest.
5. The sections
<p class="eyebrow">layers/hero/hero.php</p>
<h1 class="title">A page is a list of sections.</h1>
<p class="lead">This heading is one file. Its place on the page is one entry in <code>wireframes.php</code>.</p>
<a class="button" href="/about">About this demo</a>
A section is a file of HTML. Xonry looks for layers/hero/hero.php when the folder layers/hero exists, and for layers/hero.php when it does not. A hero.css beside it is added once to a style block in the head of every page that uses the section. A hero.js is added to a script block before the end of the body.
<?php $files = array('wireframes.php', 'head.php', 'foot.php', 'layers/hero/hero.php', 'layers/counter/counter.php'); ?>
<h2 class="heading">This list comes from a PHP loop</h2>
<ul class="file-list">
<?php foreach ($files as $file) { ?>
<li><code><?= htmlspecialchars($file) ?></code></li>
<?php } ?>
</ul>
PHP is allowed anywhere in a section. This one builds its list with a loop.
6. What the server sends
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Demo site</title>
<link rel="stylesheet" href="/css/site.css">
<meta content="(per-session value removed)" name="csrf_token">
... the styles of the six sections ...</style>
</head>
<body>
<header class="site-header">
<div class='container'>
<nav class="nav" aria-label="Main">
<a class="brand" href="/">Demo site</a>
<ul class="nav-links">
<li><a href="/">Home</a></li>
<li><a href="/about">About</a></li>
</ul>
</nav>
</div>
</header>
<section id="top" class="hero">
<div class='container'>
<p class="eyebrow">layers/hero/hero.php</p>
<h1 class="title">A page is a list of sections.</h1>
<p class="lead">This heading is one file. Its place on the page is one entry in <code>wireframes.php</code>.</p>
<a class="button" href="/about">About this demo</a>
</div>
</section>
This is the answer, cut after its first sections. Around each section is the wrapper the map asked for. The page is whole when it arrives: nothing on it waits for a script.
Limit. The styles and scripts of the sections are printed inside the page. A site rendered this way cannot use a Content-Security-Policy that forbids inline code.
Limit. Another: the engine has no page title or description per page. The <head> comes from head.php, which the template fills from one site-wide file.
7. XON in the browser
<h2 class="heading">A section with XON attributes</h2>
<p class="count">Clicked <strong id="count" data-text="counter.clicks">0</strong> times.</p>
<button type="button" class="button" id="add" data-on-click="addOne">Add one</button>
<p class="note">The markup names a store value and a function. The function itself is in <code>js/app.js</code>.</p>
// The counter section (layers/counter/counter.php) reads this store and calls this function.
xon.data('counter', { clicks: 0 });
function addOne() { xon.data('counter').clicks++; }
xon.use(addOne);
<script src="/js/xon.min.js" defer></script>
<script src="/js/app.js" defer></script>
data-text="counter.clicks" shows a value from a store named counter and keeps it up to date. data-on-click="addOne" calls a function when the button is clicked. The script creates the store, defines the function, and offers it to the page with xon.use. Markup can call only what the script has offered.
XON is a separate, released library. Xonry does not add it for you: the project loads it in foot.php. XON at xonjs.com (opens another website)
8. The same files in the dashboard
The Wireframes screen shows the map as a list of pages and a table of sections. Rows can be dragged or moved with the arrows; edited rows are written with Save. The file is saved in the project folder and the previous version is kept as wireframes.php.bak. The dashboard writes the whole file again each time, so comments in it are lost.
9. The same files over the API
GET /xonry/api/v1/projects/demo-site/pages
(dashboard session; a token would send: Authorization: Bearer xon_pat_...)
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
ETag: "929c9059210bdad0ab9f1d790ebc86a1b1ea10e1"
Cache-Control: no-store
X-Request-Id: 6e255b395456867f
RateLimit-Limit: 600
RateLimit-Remaining: 599
{
"data": [
{
"route": "about",
"title": "",
"default": true,
"sections": [],
"layout": "",
"renderLayout": "",
"layoutMissing": false,
"kind": "page"
}
],
"page": {
"limit": 25,
"next": null,
"sort": null
}
}
The project is named in every address (here it is demo-site; the listing is from the working install with the name replaced). The answer carries an ETag: for pages, the sha1 of wireframes.php. To change a page a client sends that value back in If-Match. If the file changed in between, the answer is 412 and nothing is written. Without If-Match the answer is 428.
GET /xonry/api/v1/projects/demo-site/pages
HTTP/1.1 401 Unauthorized
{
"error": {
"code": "unauthenticated",
"message": "Send Authorization: Bearer <token> (or use the dashboard session)",
"field": null
},
"request_id": "29b6f8734479f716"
}
A caller is either the dashboard session or a token. A token is created on the API tokens screen with the scopes it may use, the projects it may reach and an expiry. Xonry keeps a hash of it outside the web root.
{
"name": "pages.get",
"tool": "xonry_pages_get",
"description": "One page or layout (ETag = revision of wireframes.php)",
"status": "available",
"scope": "read:content",
... "project": true,
"writes": false,
"inputSchema": {
"type": "object",
"properties": {
"project": {
"type": "string",
"pattern": "^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$",
"description": "Project folder name (explicit in every call)"
},
"route": {
"type": "string",
"pattern": "^[A-Za-z0-9_-]{1,64}$"
}
},
"required": [
"project",
"route"
],
"additionalProperties": false
},
... "rest": {
"method": "GET",
"path": "/xonry/api/v1/projects/{project}/pages/{route}"
}
}
Each command is also described for programs: its name, whether it writes, the scope it needs and the shape of its input. 18 commands are available today; 30 more are registered as planned and answer 501.
10. The same files in OnceBuilder Studio
OnceBuilder Studio is a separate program that reads the same two things, the map and the section files, and shows them as a tree and a canvas. Today it only reads. It is in development and not released. OnceBuilder Studio (opens another website)








