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

Laravel Form Helpers Laravel Package

activismebe/laravel-form-helpers

A Laravel package of helpers for building and handling HTML forms, with utilities that simplify common form tasks like opening forms, generating fields, and working with submitted input. Lightweight and easy to drop into existing Blade views.

View on GitHub
Deep Wiki
Context7

Getting Started

Verify the package identity first. The Composer name (activismebe/laravel-form-helpers) does not match the repository (CPSB/Validation-helper). Before requiring it, open the repo and read composer.json — confirm the name, the illuminate/support constraint, and whether a service provider is declared under extra.laravel.providers.

composer require activismebe/laravel-form-helpers

If you are on Laravel 6+, expect dependency resolution to fail (the 2017-11-17 release targets the 5.x line). Two sane options: fork and bump the constraint, or copy src/ into app/Support/FormHelpers and register it manually. For a package this small (one or two classes), vendoring is usually cheaper than fighting Composer.

If auto-discovery is not declared, add the provider to config/app.php:

'providers' => [
    // ...
    Activismebe\FormHelpers\FormHelpersServiceProvider::class,
],

Where to look first. The whole public surface is a handful of functions. Grep the source to enumerate it before writing any views:

grep -rn "function " vendor/activismebe/laravel-form-helpers/src

Look for: a Blade-facing helper (error text / error class / has-error check), any published config/ or resources/views/, and whether it hooks ShareErrorsFromSession or expects $errors to already be in the view (Laravel 5.5+ provides this for free).

First use case — a contact form. Validate in the controller, redirect back with errors, and render per-field messages in Blade:

public function store(ContactRequest $request)
{
    Contact::create($request->validated());

    return redirect()->route('contact')->with('status', 'Sent.');
}
<input name="email" value="{{ old('email') }}"
       class="form-control @formErrorClass('email')">
@formError('email')

Adapt the helper names to whatever the source actually exports — the pattern (repopulate with old(), toggle an error class, print the first message) is the day-to-day win.

Implementation Patterns

Field partial, not per-input markup. Whatever the helper is, wrap it once so the helper never leaks across your views:

{{-- resources/views/partials/field.blade.php --}}
@php($name = $name ?? '')
<div class="form-group {{ $errors->has($name) ? 'has-error' : '' }}">
    <label for="{{ $id ?? $name }}">{{ $label }}</label>
    <input id="{{ $id ?? $name }}" name="{{ $name }}"
           value="{{ old($name, $value ?? '') }}"
           class="form-control">
    @if ($errors->has($name))
        <span class="help-block">{{ $errors->first($name) }}</span>
    @endif
</div>

This gives you a single place to swap the package out for Laravel's native @error directive later.

Named error bags for multi-form pages. If a page has a login form and a newsletter form, the package's global error rendering will bleed across both. Use $request->validateWithBag() / withErrors($validator, 'login') and read from $errors->login, or keep the two forms on separate routes.

FormRequest as the integration seam. Put all validation rules in a FormRequest subclass and let the helper do only presentation. This keeps the dependency shallow — if you drop the package, your validation layer is untouched.

AJAX / JSON consumers. The helper is a server-rendered concern only. For fetch/axios, skip it and rely on the 422 payload:

axios.post('/contact', data)
  .catch(e => renderErrors(e.response.data.errors)); // { email: ["..."] }

Testing against it. Assert the session contract rather than rendered HTML, so the tests survive a helper swap:

$response->assertSessionHasErrors(['email']);
$this->assertGuest();

Gotchas and Tips

  • It is probably redundant. Laravel 5.5+ shares $errors with every view via ShareErrorsFromSession, and 6.0 added @error / @enderror. Audit what the package adds on top before adopting it — for most apps that is a class-toggling convenience, nothing more.
  • Middleware group matters. $errors is only populated on routes inside the web group. A form POSTed to an api route will have an empty message bag and your helpers will silently render nothing.
  • Dot notation for nested fields. items.0.name and wildcards ($errors->has('items.*.name')) behave differently; the helper may not normalize either. Test array inputs (tags[]) explicitly.
  • Old input and arrays need old('tags', []) handling with in_array checks — helpers rarely cover this.
  • Escape your output. This predates the broad use of {{ }} audits; confirm the helper returns raw strings rather than HtmlString before trusting it with user-influenced attribute values.
  • Debugging order: (1) is the route in web, (2) dd(session('errors')) after redirect, (3) dd($errors->all()) in the view, (4) only then suspect the helper.
  • Extension points are limited to whatever it publishes. Publish first (php artisan vendor:publish --provider=...) to see config and views; if nothing publishes, treat the source as read-only and wrap it in your own partial.
  • Abandonment risk. Last release 2017, one star, zero dependents. Pin the exact version in composer.json, or vendor the class. Do not build new features that assume it will be maintained — keep the field partial as your abstraction boundary so removal is a one-file change.
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.
mehedimi/laravel-amp-mail
happones/laravel-vue-i18n-generator
jwerd/inertia-table
siberfx/flysystem-wasabi
hollyit/token-replace
ippanelcom/laravel-sdk
adachsoft/changelog-linter
adachsoft/collection
payerurl/telegrambot-crypto-payment-instant-payout
dskripchenko/laravel-hybrid-search
riorizkyrainey/lara-ced
mehedimi/static-vel
zharp/zharp
nonsapiens/bigquery-model-sync
lgu-bayambang-ict-office/lgu-laravel-development-standards
andydefer/laravel-support
se7enxweb/flysystem
lampwick/laravel
jeslage/statamic-emojis
micahdshackelford/rmap-laravel