PHPackages                             protrafficgroup/orchid-laraberg - 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. [File &amp; Storage](/categories/file-storage)
4. /
5. protrafficgroup/orchid-laraberg

ActiveLibrary[File &amp; Storage](/categories/file-storage)

protrafficgroup/orchid-laraberg
===============================

v0.2.0(1mo ago)2118MITBlade

Since Oct 31Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/New1nd/Orchid-Laraberg)[ Packagist](https://packagist.org/packages/protrafficgroup/orchid-laraberg)[ RSS](/packages/protrafficgroup-orchid-laraberg/feed)WikiDiscussions main Synced today

READMEChangelogDependencies (4)Versions (4)Used By (0)

Orchid Laraberg
===============

[](#orchid-laraberg)

A field that drops the Gutenberg block editor into an Orchid Platform screen. Wraps [van-ons/laraberg](https://github.com/VanOns/laraberg) with an Orchid `Field`, a paste handler that strips Word/Docs cruft so pasting doesn't freeze the browser, and an opt-in bridge to a Laravel media-upload endpoint.

> Requires PHP 8.1+, Orchid Platform ^14.15. License: MIT (this wrapper). Laraberg itself is GPL-3.0-or-later — read its license before shipping commercial software.

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

[](#table-of-contents)

- [Installation](#installation)
- [Usage in an Orchid screen](#usage-in-an-orchid-screen)
- [Options](#options)
- [Media uploads](#media-uploads)
- [Paste cleanup](#paste-cleanup)
- [Custom blocks](#custom-blocks)
- [Credits](#credits)

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

[](#installation)

```
composer require protrafficgroup/orchid-laraberg
```

The service provider auto-discovers and publishes Laraberg + wrapper assets on first boot. If something prevents auto-publishing (custom container, console-only runs), do it explicitly:

```
php artisan vendor:publish --provider="VanOns\Laraberg\LarabergServiceProvider" --tag=public
```

To customise the default options array:

```
php artisan vendor:publish --tag=laraberg-config
```

Usage in an Orchid screen
-------------------------

[](#usage-in-an-orchid-screen)

```
use Orchid\Support\Facades\Layout;
use ProTrafficGroup\OrchidLaraberg\Laraberg;

public function layout(): iterable
{
    return [
        Layout::rows([
            Laraberg::make('content')->title('Body'),
        ]),
    ];
}
```

The submit handler receives the raw Gutenberg HTML in `$request->input('content')` — store it directly. To render on the public site, use the `RendersContent` trait from the upstream Laraberg:

```
use Illuminate\Database\Eloquent\Model;
use VanOns\Laraberg\Traits\RendersContent;

class Post extends Model
{
    use RendersContent;
}

// in a Blade view:
// {!! $post->render() !!}
```

By default the trait reads the `content` column. Override via `protected $contentColumn = 'body';` or pass the name into `$post->render('body')`.

Options
-------

[](#options)

`Laraberg::make()->setOptions([...])` forwards options into `Laraberg.init` on the client. Anything supported by Laraberg's `EditorSettings` works — height, sizes, colours, gradients, disabled core blocks, and so on.

```
Laraberg::make('content')
    ->setOptions([
        'height'             => '600px',
        'maxWidth'           => 800,
        'disabledCoreBlocks' => ['core/code', 'core/freeform'],
        'colors'             => [
            ['name' => 'Brand red', 'slug' => 'brand-red', 'color' => '#c0392b'],
        ],
    ]);
```

Use `mergeOptions([...])` to add to an existing set without replacing it. The default option set lives in `config/orchid-laraberg.php` and is read on every `Laraberg::make()` call.

Media uploads
-------------

[](#media-uploads)

Set the special `_mediaUploadEndpoint` option to a route URL — the field wires that URL into Gutenberg's `mediaUpload` callback, so Image / Gallery / Cover / Video blocks send selected files there.

```
Laraberg::make('content')
    ->setOptions([
        '_mediaUploadEndpoint' => route('platform.laraberg.media'),
    ]);
```

The frontend posts `multipart/form-data` with `files[]`, plus a CSRF header (`X-CSRF-TOKEN` from `` if present, otherwise `X-XSRF-TOKEN` derived from the cookie — one of them will be accepted by Laravel's `VerifyCsrfToken` middleware).

Your endpoint must return JSON in this shape:

```
[
    {
        "id": 42,
        "url": "https://example.test/storage/2026/05/17/abc.png",
        "mime": "image/png",
        "title": "logo.png",
        "alt": "logo.png",
        "caption": ""
    }
]
```

### Reference implementation

[](#reference-implementation)

Using Orchid's built-in `Attachment` (deduplicates by hash, ships with the platform):

```
namespace App\Http\Controllers;

use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use Orchid\Attachment\File;

class LarabergMediaController extends Controller
{
    public function __invoke(Request $request): JsonResponse
    {
        $request->validate([
            'files'   => 'required|array|min:1',
            'files.*' => 'file|max:20480',
        ]);

        $payload = [];

        foreach ($request->file('files') as $uploaded) {
            $attachment = (new File($uploaded))->load();

            $payload[] = [
                'id'      => $attachment->id,
                'url'     => $attachment->url(),
                'mime'    => $attachment->mime,
                'title'   => $attachment->original_name,
                'alt'     => $attachment->original_name,
                'caption' => '',
            ];
        }

        return response()->json($payload);
    }
}
```

Route — register it **inside `routes/platform.php`** so the `platform` middleware adds auth + CSRF + the dashboard prefix:

```
Route::post('/laraberg/media', LarabergMediaController::class)
    ->name('platform.laraberg.media');
```

### Operational notes

[](#operational-notes)

- Set `APP_URL` to the URL the editor is opened on (`http://example.test:81`). `Storage::disk('public')->url(...)` builds absolute URLs from it; if `APP_URL` is wrong, every uploaded image 404s.
- `php artisan storage:link` must have been run; otherwise the `/storage/...` URL has no symlink to serve.
- Default `nginx` `client_max_body_size` is `1m`. Raise it for larger uploads. PHP `upload_max_filesize` and `post_max_size` apply too — the real ceiling is the minimum of nginx / php / `files.*|max:` validator.

Paste cleanup
-------------

[](#paste-cleanup)

When pasting from Word, Google Docs, or a browser page, Gutenberg's `pasteHandler` parses the HTML through a multi-pass DOMParser pipeline and matches it against every registered block. Rich HTML from word processors can trigger multi-second freezes.

The field auto-registers a `blocks.pasteHandler` filter that strips, before Gutenberg sees the HTML:

- Word-only attributes — `style`, `class`, `lang`, `mso-*`
- Conditional comments — ``
- Namespaced tags — ``, ``, ``, ``
- Bare `` / `` wrappers

For most Word / Docs paste flows this turns multi-second freezes into instant pastes. No configuration needed.

Plain-text paste (`Ctrl+Shift+V` / `⌘+Shift+V`) bypasses the filter entirely and is always fast.

Custom blocks
-------------

[](#custom-blocks)

Anything that works against `van-ons/laraberg` v2.0.x works here unchanged — this wrapper does not touch block registration. See the upstream [custom block docs](https://github.com/VanOns/laraberg#custom-blocks).

The bundled WordPress packages are exposed via the global `Laraberg` object:

- `Laraberg.wordpress.blockEditor`
- `Laraberg.wordpress.blocks`
- `Laraberg.wordpress.components`
- `Laraberg.wordpress.data`
- `Laraberg.wordpress.element`
- `Laraberg.wordpress.hooks`
- `Laraberg.wordpress.serverSideRender`

Credits
-------

[](#credits)

This package is a thin Orchid-flavored wrapper around [van-ons/laraberg](https://github.com/VanOns/laraberg) (GPL-3.0-or-later). All of the heavy lifting — bundling Gutenberg, rendering blocks, exposing WordPress packages — happens in that project.

###  Health Score

39

—

LowBetter than 84% of packages

Maintenance90

Actively maintained with recent releases

Popularity14

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity35

Early-stage or recently created project

 Bus Factor1

Top contributor holds 91.7% 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 ~465 days

Total

3

Last Release

46d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/62959134?v=4)[Newind](/maintainers/Newind)[@NeWind](https://github.com/NeWind)

---

Top Contributors

[![New1nd](https://avatars.githubusercontent.com/u/10168197?v=4)](https://github.com/New1nd "New1nd (22 commits)")[![NikitaRa1n](https://avatars.githubusercontent.com/u/20434554?v=4)](https://github.com/NikitaRa1n "NikitaRa1n (2 commits)")

### Embed Badge

![Health badge](/badges/protrafficgroup-orchid-laraberg/health.svg)

```
[![Health](https://phpackages.com/badges/protrafficgroup-orchid-laraberg/health.svg)](https://phpackages.com/packages/protrafficgroup-orchid-laraberg)
```

PHPackages © 2026

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