Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Hello Stimulus Bundle Laravel Package

hello-sebastian/hello-stimulus-bundle

Symfony bundle that brings Stimulus controllers into your PHP app, handling controller discovery, asset registration and Twig helpers so you can add lightweight JavaScript behaviour without a full front-end framework. Simplifies wiring Symfony assets to Stimulus.

View on GitHub
Deep Wiki
Context7

Getting Started

This is an initial assessment for v0.2.0 of the package. The release adds a single method, setControllerNameToFormView(), which sets a controller data attribute on the rendered <form> tag. Treat the package as early-stage (0.x) and verify the exact attribute name in the rendered HTML before relying on it.

Start here:

  1. README and src/ — find the form builder or form view class that renders the <form> tag. That is where setControllerNameToFormView() lives and where the data attribute is applied.
  2. Tests — look for form-rendering tests to confirm the exact output (for example, whether the attribute is data-controller or a package-specific key).
  3. Service provider / config — check whether the attribute name, view, or form tag rendering can be configured.

Minimal first use case: render a form that a front-end controller (for example, a Stimulus/Hotwire controller) can hook into.

// In the controller or form-building layer that renders the form:
$form->setControllerNameToFormView('signup-form');

return view('signup', ['form' => $form]);

Inspect the rendered HTML to confirm the attribute appears on the <form> tag. If you are not using a JS controller framework, this method is still useful as a semantic hook for tests or for attaching behavior via data-* selectors.

Implementation Patterns

Set the controller name at the form-building layer, not in the Blade view. The method belongs to the form object, so call it in the controller/action, form request, or dedicated form class before the view renders. This keeps the form definition testable and avoids scattering attribute logic across templates.

public function create()
{
    $form = $this->formBuilder->make('signup');
    $form->setControllerNameToFormView('signup-form');

    return view('signup.create', compact('form'));
}

Use it as the front-end integration point for interactive forms. The most natural day-to-day use is attaching a Stimulus (or similar) controller to a form that needs client-side validation, auto-save, conditional fields, or submission state handling. The package now avoids hand-writing the data attribute in Blade.

Keep controller names stable and descriptive. Use names that match your JS controller identifiers (for example, signup-form, checkout-validation, search-filters). If multiple forms appear on one page, set a distinct controller name per form rather than reusing a generic one.

Assert the rendered attribute in tests. Since the feature is a rendered HTML attribute, cover it at the view/integration level:

$response = $this->get('/signup');

$response->assertSee('data-controller="signup-form"', false);

Adjust the assertion to the actual attribute key produced by the package.

Combine with existing form attributes deliberately. If your form builder already supports attributes, methods, or action configuration, set the controller name alongside those calls and confirm that later attribute rendering does not overwrite the data attribute.

Gotchas and Tips

  • Confirm the actual attribute name. The method name refers to a “controller name,” but the rendered output may be data-controller, data-controller-name, or another key. Inspect the HTML before writing JS selectors or test assertions.
  • Call it before the form renders. If the form tag is rendered early or cached, setting the controller name afterward will not appear in the output. Treat it like any other pre-render form configuration.
  • Watch for overwrites. If the underlying form builder sets attributes in bulk or merges arrays, the controller data attribute could be replaced. Check the order of configuration calls.
  • Do not pass untrusted input as the controller name. Controller names are rendered into HTML attributes. Keep them as developer-defined strings, and let the package’s escaping handle the rest.
  • Multiple controllers may need a space-separated value. If your front-end framework expects multiple controller names in one attribute, verify whether the package supports that or whether a second call overwrites the first.
  • Debug from the rendered HTML first. Use assertSee(..., false), browser dev tools, or a quick dd($form) to confirm the form object state and the final tag output.
  • Extension point: if you need a different data attribute or additional controller metadata, look at whether the form view can be overridden or whether the builder exposes a generic attribute method. Avoid forking the package for a one-off attribute.
  • 0.x API churn: with a single-method release, the package surface is small and may change. Pin the version in composer.json and re-check rendered output after upgrades.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
se7enxweb/flysystem
lampwick/laravel
jeslage/statamic-emojis
micahdshackelford/rmap-laravel
draftsmaninc/draftsman
square-bit/laravel-volition
himito/laravel-mailman
htinlynn/genius-helper
maco-studios/hephaestus
elmogy/larafast
xeviant/laravel-paystack
gorilladash/laravel-website-sdk
martialbe/flysystem-oss
chondal/3312client
jeroen-g/flickr
opscale-co/nova-genbi
itsjustvita/laravel-retention
tequilarapido/trackit
gregsphotography/site-builder-filament
cabaoctavio/laravel-query-log