PHPackages                             nomadicjosh/vihzhuo - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. nomadicjosh/vihzhuo

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

nomadicjosh/vihzhuo
===================

A drag and drop pagebuilder to manage pages in any PHP project.

v2.0.0(6d ago)0362MITPHPPHP &gt;=8.4

Since Mar 7Pushed 5d agoCompare

[ Source](https://github.com/nomadicjosh/vihzhuo)[ Packagist](https://packagist.org/packages/nomadicjosh/vihzhuo)[ Docs](https://github.com/nomadicjosh/vihzhuo)[ RSS](/packages/nomadicjosh-vihzhuo/feed)WikiDiscussions main Synced yesterday

READMEChangelogDependencies (10)Versions (8)Used By (2)

Vihzhuo
=======

[](#vihzhuo)

Vihzhuo is a framework-agnostic drag-and-drop page builder for PHP applications. It is a fork of [PHPageBuilder](https://github.com/HansSchouten/PHPageBuilder), modernized for PHP 8.4, strict types, PSR-7 HTTP messages through `qubus/http`, GrapesJS 0.23, and PHPStan level `max`.

Vihzhuo provides:

- a website manager for creating pages, routes, layouts, and translations;
- a GrapesJS page builder with blocks, block settings, responsive previews, an asset manager, a Style Manager, and a built-in rich-text editor;
- convention-based themes, layouts, HTML blocks, and server-rendered PHP blocks;
- PSR-7 entry points that can run standalone or behind an existing framework;
- replaceable authentication, routing, storage records, repositories, caching, themes, and page-builder services;
- extension APIs for blocks, layouts, CSS, and JavaScript supplied by application code or Composer packages.

Table of contents
-----------------

[](#table-of-contents)

- [Requirements](#requirements)
- [Installation](#installation)
- [Configuration](#configuration)
- [Running Vihzhuo](#running-vihzhuo)
- [Integrating with an existing project or framework](#integrating-with-an-existing-project-or-framework)
- [Creating a theme](#creating-a-theme)
- [Creating a layout](#creating-a-layout)
- [Creating blocks](#creating-blocks)
- [Block settings and field types](#block-settings-and-field-types)
- [Nested blocks and shortcodes](#nested-blocks-and-shortcodes)
- [Custom block models and controllers](#custom-block-models-and-controllers)
- [Block JavaScript](#block-javascript)
- [Adding CSS and JavaScript assets](#adding-css-and-javascript-assets)
- [Registering blocks and layouts from application code](#registering-blocks-and-layouts-from-application-code)
- [Customizing GrapesJS](#customizing-grapesjs)
- [Routing and multilingual pages](#routing-and-multilingual-pages)
- [Uploads and the Asset Manager](#uploads-and-the-asset-manager)
- [Caching](#caching)
- [Security notes](#security-notes)
- [Development and quality checks](#development-and-quality-checks)

Requirements
------------

[](#requirements)

- PHP 8.4 or newer;
- PDO and the PDO driver for your database;
- JSON and fileinfo PHP extensions;
- Composer 2;
- a writable uploads directory;
- Node.js 20 or newer only when rebuilding the browser assets.

The checked-in `dist/` directory contains the browser assets needed by an application. Application users do not need Node.js unless they modify Vihzhuo's JavaScript or Sass sources.

Installation
------------

[](#installation)

Install the package:

```
composer require nomadicjosh/vihzhuo
```

When working from this repository instead of consuming a release:

```
composer install
npm install
npm run production
```

Copy the example configuration and adjust it for the application:

```
cp config/config.example.php config/config.php
```

Create the `pages`, `page_translations`, `uploads`, and `settings` tables. [`config/create-tables.sql`](config/create-tables.sql) contains the MySQL/MariaDB schema. When using SQLite or another PDO database, create equivalent tables and preserve the column names and unique constraints used by that schema.

The application must make these locations writable by the PHP process when enabled:

```
storage.uploads_folder
cache.folder

```

Configuration
-------------

[](#configuration)

The complete annotated example is in [`config/config.example.php`](config/config.example.php). The most important options are:

KeyPurpose`general.base_url`Absolute application URL, including a subdirectory when applicable.`general.language`Default locale, such as `en`.`general.assets_url`Public URL prefix through which Vihzhuo serves its `dist/` files.`general.uploads_url`Public URL prefix used for uploaded files.`storage.use_database`Enables the built-in PDO-backed repositories. The default manager requires it.`storage.database.driver`Database driver name. Use `sqlite` to enable SQLite foreign keys.`storage.database.dsn`PDO DSN, for example `sqlite:/absolute/path/site.sqlite` or `mysql:host=127.0.0.1;dbname=site;charset=utf8mb4`.`storage.database.username` / `password`PDO credentials; these may be `null` for SQLite.`storage.database.options`Optional PDO options.`storage.database.prefix`Optional prefix prepended to Vihzhuo table names.`storage.uploads_folder`Absolute directory used by the image Asset Manager.`auth.use_login`Enables the bundled session login flow.`auth.class`Class implementing `AuthContract`.`auth.url`URL of the login endpoint.`website_manager.use_website_manager`Enables the bundled page-management interface.`website_manager.class`Class implementing `WebsiteManagerContract`.`website_manager.url`Base URL of the manager.`pagebuilder.class`Class implementing `PageBuilderContract`.`pagebuilder.url`URL of the GrapesJS editor.`pagebuilder.actions.back`Destination of the editor's Back button.`page.class`Page record implementing `PageContract`.`page.table`Pages table name without the configured prefix.`page.translation.*`Translation class, table, and page foreign key.`cache.enabled`Enables rendered-page caching.`cache.folder`Absolute cache directory.`cache.class`Class implementing `CacheContract`.`theme.folder`Absolute parent directory containing all themes.`theme.folder_url`Public URL corresponding to `theme.folder`.`theme.active_theme`Folder name of the active theme.`router.class`Class implementing `RouterContract`.`class_replacements`Map of concrete Vihzhuo classes to compatible application replacements.A typical PDO configuration is:

```
