norman-huth/nova-bbcode-textarea
A Laravel Nova field that adds a BBCode-ready textarea to your admin forms, making it easy to edit and manage BBCode-formatted content within Nova resources. Lightweight and simple to integrate into existing packages.
This package is archived and unmaintained (last release July 2022), so treat it as a legacy dependency rather than something to reach for on a new build. If you are working in an existing Nova app that already depends on it, the workflow is:
composer require norman-huth/nova-bbcode-textarea (or clone/fork into a path repository if Packagist resolution breaks).use NormanHuth\NovaBbcodeTextarea\BbcodeTextarea;
public function fields(Request $request)
{
return [
BbcodeTextarea::make('Body', 'body')
->rules('required', 'string', 'max:65535')
->help('BBCode is supported: [b], [i], [url], [quote]'),
];
}
text/mediumText, not varchar(255).The first realistic use case is a forum/post/comment resource where you want contributors to write light markup without a full WYSIWYG, and you render the BBCode to HTML separately on the frontend.
Separate storage from rendering. The field should be treated purely as a form control that persists a raw BBCode string. Do the BBCode→HTML conversion in your application layer (a parser such as laravel-bbcode/symfony-style parser or a custom transformer), then sanitize the resulting HTML before output. Never render the stored value with {!! !!} directly.
Detail and index views. Raw BBCode in a detail view is noisy. If the field supports it, use ->asHtml() or render a parsed preview; otherwise hide it on index (->hideFromIndex()) or transform via ->displayUsing(fn ($v) => Str::limit(strip_tags($parsed), 120)).
Validation belongs in the field. Use Nova's ->rules() and ->nullable() rather than relying on the request-level form request, because action forms and inline resource creation won't go through your controller validation.
Actions and tools. Drop the field into action modal forms and custom Nova tools the same way you would any other Nova field. Keep the field name identical to the model attribute so Nova's mass-assignment/fill logic works without a custom fillUsing.
Frontend integration tip. Because the model attribute is just a string, you can render it in Blade partials, API resources, or Inertia props after a single parser call. Centralize the parse+sanitize step in one presenter/service so the editor, detail view, and public site agree on supported tags.
Migration pattern for an existing Textarea field. Swap the class in fields(), keep the same column and validation, and backfill nothing — BBCode and plaintext coexist in the same column harmlessly if your renderer escapes unknown plaintext.
Textarea plus a client-side renderer).composer.json will constrain laravel/nova and php to old ranges. Expect to need --ignore-platform-reqs (bad idea in production) or a fork with loosened constraints.[url=javascript:...] and [img] tags are classic vectors. Always sanitize the HTML after parsing, and consider an allow-list of tags.php artisan nova:publish, clear config/cache, and check the browser network tab for a 404 on the field's compiled assets. Nova 4+ uses Vite-built assets; older tooling may not register correctly.showOnDetail surprises. A raw-BBCode textarea on the detail screen is often the "why does this look broken" bug report. Default it off on index and detail unless you explicitly want the raw source visible.use statement and that the package's service provider is auto-discovered (php artisan package:discover). For path-repo installs, re-run discovery after every change.How can I help you explore Laravel packages today?