keruyphp/fluent-bulma

Flexible fluent PHP DSL for Bulma.

Maintainers

Package info

github.com/KeruyPHP/fluent-bulma

pkg:composer/keruyphp/fluent-bulma

Statistics

Installs: 0

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v1.0.0 2026-05-06 19:18 UTC

This package is auto-updated.

Last update: 2026-05-06 19:22:43 UTC


README

Simple fluent PHP DSL for applying Bulma classes to fluent-html elements.

Installation

composer require keruyphp/fluent-bulma

Minimal setup

<?php

declare(strict_types=1);

require __DIR__ . '/vendor/autoload.php';

use KeruyPHP\FluentBulma\Bulma;
use KeruyPHP\FluentHtml\Html;
use KeruyPHP\FluentHtml\HtmlElement;

HtmlElement::extend('bulma', fn(HtmlElement $el) => new Bulma($el));

echo Html::button('Save')
	->bulma()->button()->isPrimary()->isRounded();

Main Bulma elements

Start with a normal fluent-html element, then call bulma().

Title

echo Html::h1('Dashboard')
	->bulma()->title()->is_1();

Button

echo Html::button('Save')
	->bulma()->button()->isPrimary()->isRounded();

Notification

echo Html::div('Profile updated')
	->bulma()->notification()->isSuccess();

Columns

echo Html::div(function () {
	Html::div('Left column')->bulma()->column();
	Html::div('Right column')->bulma()->column();
}));

Input

echo Html::input(['type' => 'text'])
	->bulma()->input()->isRounded();

Tag

echo Html::span('New')
	->bulma()->tag()->isInfo()->isRounded();

Helpers

Bulma helpers are available through helpers().

echo Html::span('Info text')
	->bulma()->helpers()->textColor()->hasTextInfo();

Returning to HtmlElement

Bulma methods return helper objects. Call end() to get the original HtmlElement back.

echo Html::button('Open')
	->bulma()->button()->isPrimary()->end()
	->prop('type', 'button')
	->class('custom-button');

Notes

  • fluent-bulma works on top of fluent-html.
  • You can still use normal HtmlElement methods like class(), prop(), attrs() and pretty().
  • Many Bulma modifier methods are virtual and are converted from camelCase to kebab-case classes automatically.