soarecostin/blade-form-components

Laravel Blade form components

v0.3.0 2020-03-24 20:32 UTC

This package is auto-updated.

Last update: 2024-04-25 06:14:48 UTC


README

Software License Build Status StyleCI Scrutinizer Code Quality Build Status Total Downloads

This package allows to you build forms in blade in a clean and easy way. It provides a @form directive that you can use in Blade in order to render forms. The forms can be rendered in Bootstrap, Bulma or Tailwind.

Installation

You can install the package via composer:

composer require soarecostin/blade-form-components

Usage

Example

A demo usage of this package can be seen at: https://bfc-demo.dev.soa.re/ (github repo)

The demo uses the following Blade template in order to render the form:

@form('open')

    @form('input', ['name' => 'id', 'disabled' => true, 'value' => 1])
    
    @form('input', ['name' => 'name', 'required' => true, 'placeholder' => 'John Doe'])
    
    @form('password', ['name' => 'password', 'required' => true, 'help' => 'Minimum 6 characters'])
    
    @form('email', ['name' => 'email', 'required' => true, 'placeholder' => 'john.doe@gmail.com'])

    @form('input', ['name' => 'price', 'class' => 'is-rounded is-expanded', 'required' => true,
        'addons' => $priceAddons,
    ])

    @form('textarea', ['name' => 'message', 'rows' => 6, 'desc' => 'Let us know how we can help you below'])

    @form('select', [
        'name' => 'language',
        'label' => 'Language',
        'options' => [
            'en' => 'English',
            'fr' => 'French'
        ],
        'nulloption' => 'Please select',
    ])

    @form('checkbox', ['name' => 'terms', 'label' => 'I agree to the Terms and Conditions'])

    @form('submit', ['name' => 'Submit', 'class' => 'is-warning'])

@form('close')

Customization

You can publish the configuration file, that contains all the available checks using:

php artisan vendor:publish --provider=SoareCostin\BladeFormComponents\BladeFormComponentsServiceProvider

This will publish a blade-form-components.php file in your config folder.

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email soarecostin@gmail.com instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.

Laravel Package Boilerplate

This package was generated using the Laravel Package Boilerplate.