PHPackages                             melazhari/sulu-builder-bundle - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Admin Panels](/categories/admin)
4. /
5. melazhari/sulu-builder-bundle

ActiveSymfony-bundle[Admin Panels](/categories/admin)

melazhari/sulu-builder-bundle
=============================

Sulu Builder - manage and build Sulu XML templates from a native Sulu Administration view.

v1.2.0(1mo ago)08MITJavaScriptPHP ^7.2 || ^8.0

Since Jul 11Pushed 1mo agoCompare

[ Source](https://github.com/Melazhari1/sulu-builder-bundle)[ Packagist](https://packagist.org/packages/melazhari/sulu-builder-bundle)[ RSS](/packages/melazhari-sulu-builder-bundle/feed)WikiDiscussions main Synced 1w ago

READMEChangelogDependencies (5)Versions (10)Used By (0)

SuluBuilderBundle
=================

[](#sulubuilderbundle)

A production-ready Sulu CMS bundle that adds a **"Sulu Builder"** top-level item to the Sulu Administration navigation. It lists the XML templates of your project (pages, snippets, … — configurable) and lets you **create, edit, import and save them with the embedded builderxml visual builder** (drag-and-drop designer with XML generate/import), backed by a JSON admin API with well-formed-XML validation on save.

- Compatible with **Sulu 2.4 – 2.6**, PHP &gt;= 7.2, Symfony 5.4 / 6.x
- PSR-4 / PSR-12 compliant
- Uses only the Sulu Admin React ecosystem (no extra UI framework)
- Permissions integrated with Sulu's security contexts (Settings → User roles)

---

1. Bundle structure — where each file belongs
---------------------------------------------

[](#1-bundle-structure--where-each-file-belongs)

```
SuluBuilderBundle/
├── composer.json                              Package definition (type: symfony-bundle, PSR-4: Xxp\SuluBuilderBundle\)
├── INSTALL.md                                 Step-by-step installation instructions
├── install.php                                CLI installer: configures a Sulu project automatically (idempotent)
├── SuluBuilderBundle.php                      Bundle class (entry point registered in config/bundles.php)
│
├── Admin/
│   └── BuilderAdmin.php                       Sulu Admin class: navigation item, admin view ("/builder"),
│                                              security context. Tagged with "sulu.admin" in services.xml.
├── Controller/
│   └── Admin/
│       └── TemplateController.php             JSON admin API (list / get / save XML templates), served
│                                              below /admin/api behind the Sulu admin firewall.
├── Service/
│   └── TemplateXmlManager.php                 Domain service: scans the configured directories, reads and
│                                              writes template files, validates XML, prevents path traversal.
├── Exception/
│   ├── TemplateNotFoundException.php          Thrown for unknown type/key → 404
│   └── InvalidTemplateException.php           Thrown for malformed XML / invalid key → 400
├── DependencyInjection/
│   ├── SuluBuilderExtension.php               Loads services.xml, exposes bundle configuration
│   └── Configuration.php                      Config tree: sulu_builder.template_directories
│
└── Resources/
    ├── config/
    │   ├── services.xml                       Service definitions & DI wiring (admin, service, controller)
    │   └── routing_api.yml                    API routes, imported by the project with the /admin/api prefix
    ├── translations/
    │   ├── admin.en.json                      Admin UI translations (Symfony "admin" domain — picked up
    │   └── admin.fr.json                      automatically by the Sulu admin translation endpoint)
    ├── public/
    │   └── builder/                           Embedded visual builder (copy of the builderxml app plus
    │                                          js/suluBridge.js, the postMessage bridge) — published to
    │                                          public/bundles/sulubuilder/ by "bin/console assets:install"
    └── js/                                    Frontend package compiled by the Sulu admin webpack build
        ├── package.json                       npm package manifest ("sulu-builder-bundle")
        ├── index.js                           Registers the view in Sulu's viewRegistry and the config hook
        ├── config.js                          Endpoint config, filled at boot from BuilderAdmin::getConfig()
        └── views/
            ├── Builder.js                     List view (mobx + Sulu components: Breadcrumb, Table,
            │                                  Icon, Loader, withToolbar) — the "Sulu Builder" page
            ├── BuilderEdit.js                 Editor view ("/builder/add" and "/builder/:type/:key"):
            │                                  embeds the visual builder in an iframe and loads/saves
            │                                  through the postMessage bridge + admin API
            └── builder.scss                   View styles (CSS modules, native Sulu spacing)

```

(`tests/bridge-test.html` is a standalone browser test of the postMessage bridge — open it over HTTP and it prints PASS/FAIL lines.)

How the pieces connect:

1. `BuilderAdmin::configureViews()` registers the admin route `/builder` with the view type `sulu_builder.builder`.
2. `Resources/js/index.js` registers the React component under that same key in the `viewRegistry` — this is how Sulu knows which component to render.
3. `BuilderAdmin::configureNavigationItems()` adds the navigation entry pointing at the view.
4. `BuilderAdmin::getConfig()` generates the API URLs from the named routes and hands them to the frontend at boot time (`initializer.addUpdateConfigHook` in `Resources/js/index.js`) — so the admin prefix (`/admin` by default) is **dynamic**, never hard-coded in JavaScript.
5. The React views call the templates endpoint, handled by `TemplateController` → `TemplateXmlManager`.
6. The editor view embeds `Resources/public/builder/index.html` (the builderxml app) in an iframe; `suluBridge.js` inside the app answers `sulu-builder:load` / `sulu-builder:new` / `sulu-builder:request-xml` postMessages, so the same visual builder is used to create, edit and import templates, and Save round-trips through the admin API.

---

2. Installation
---------------

[](#2-installation)

Full step-by-step instructions (composer, bundle registration, routing, frontend build, permissions, troubleshooting) live in **[INSTALL.md](INSTALL.md)**.

Most of the configuration can be done automatically — after `composer require`, run:

```
php vendor/melazhari/sulu-builder-bundle/install.php   # add --dry-run to preview
```

It registers the bundle, auto-detects the admin prefix, creates the routing/config files and adds a relative import of the frontend sources to the admin entry point (no npm linking — use `--npm` if you prefer a `file:` dependency). Only `npm run build`, `cache:clear` and the permission grant remain manual.

The admin URL prefix is **dynamic**: the API routes take whatever prefix you choose when importing `Resources/config/routing_api.yml` (default `/admin/api`), and the React view receives the resulting URLs at runtime via `BuilderAdmin::getConfig()`. Projects mounting the Administration on a custom path only adjust the routing prefix.

---

3. Permissions
--------------

[](#3-permissions)

The bundle registers the security context `sulu.builder.templates` under the **"Sulu Builder"** group. After installation, go to **Settings → User roles** in the Administration and grant *View* (and *Edit* if you want saving) to the relevant roles. The navigation item is hidden for users without the *View* permission.

---

4. API
------

[](#4-api)

URLs below assume the default `/admin/api` prefix — they follow whatever prefix your project uses for the routing import.

MethodURLDescriptionGET`/admin/api/builder/templates`List all templates of all configured typesGET`/admin/api/builder/templates/{type}/{key}`Get the raw XML content of one templatePUT`/admin/api/builder/templates/{type}/{key}`Save content: `{"content": "…"}` — validates well-formed XML---

5. Extending
------------

[](#5-extending)

- **New template types**: add a directory to `sulu_builder.template_directories`.
- **New views**: add a `createViewBuilder()` call in `BuilderAdmin::configureViews()` and register the matching React component in `Resources/js/index.js` — the list ("/builder") and editor ("/builder/:type/:key") views show the pattern.
- **Visual builder**: the XML editor in `BuilderEdit.js` is a plain (dependency-free) code textarea; it can be swapped for a richer editor or a drag-and-drop builder — the load/save API and the view wiring stay the same.

Theming &amp; responsiveness
----------------------------

[](#theming--responsiveness)

The view reuses Sulu Admin components (`Table`, `Breadcrumb`, `Loader`, toolbar via `withToolbar`), so typography, colors, icons and spacing are inherited from the Sulu admin theme. Sulu ≤ 2.6 ships a single (light) theme; because no colors are hard-coded in the components used, a future Sulu dark theme will apply automatically. The layout is fluid and adds reduced padding below 700px.

###  Health Score

38

—

LowBetter than 83% of packages

Maintenance90

Actively maintained with recent releases

Popularity4

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity44

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

9

Last Release

50d ago

PHP version history (2 changes)v1.0.0PHP &gt;=8.0

v1.0.1PHP ^7.2 || ^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/427f718b14c1fed583689dee3cae86d1f71c658a3a77edbe3526b11d0f5dd478?d=identicon)[melazhari](/maintainers/melazhari)

---

Top Contributors

[![Melazhari1](https://avatars.githubusercontent.com/u/91341685?v=4)](https://github.com/Melazhari1 "Melazhari1 (9 commits)")

---

Tags

xmltemplatesadminsulusulu-bundle

### Embed Badge

![Health badge](/badges/melazhari-sulu-builder-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/melazhari-sulu-builder-bundle/health.svg)](https://phpackages.com/packages/melazhari-sulu-builder-bundle)
```

###  Alternatives

[easycorp/easyadmin-bundle

Admin generator for Symfony applications

4.3k18.7M443](/packages/easycorp-easyadmin-bundle)[symfony/framework-bundle

Provides a tight integration between Symfony components and the Symfony full-stack framework

3.6k263.2M12.7k](/packages/symfony-framework-bundle)[flow-php/flow

PHP ETL - Extract Transform Load - Data processing framework

86538.6k](/packages/flow-php-flow)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
