PHPackages                             sukohi/form-strap - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Templating &amp; Views](/categories/templating)
4. /
5. sukohi/form-strap

ActiveLibrary[Templating &amp; Views](/categories/templating)

sukohi/form-strap
=================

A PHP package mainly developed for Laravel to generate form input tags of Bootstrap that can display errors.

2.0.1(10y ago)0108MITPHP

Since Jun 18Pushed 10y ago1 watchersCompare

[ Source](https://github.com/SUKOHI/FormStrap)[ Packagist](https://packagist.org/packages/sukohi/form-strap)[ RSS](/packages/sukohi-form-strap/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (2)Versions (8)Used By (0)

FormStrap
=========

[](#formstrap)

A PHP package mainly developed for Laravel to generate form input tags of Bootstrap that can automatically display errors, labels and alerts.
(This is for Laravel 5+. [For Laravel 4.2](https://github.com/SUKOHI/FormStrap/tree/1.0))

Installation
============

[](#installation)

Add this package name in composer.json

```
"require": {
  "sukohi/form-strap": "2.*"
}

```

Execute composer command.

```
composer update

```

Register the service provider in app.php

```
'providers' => [
    ...Others...,
    Sukohi\FormStrap\FormStrapServiceProvider::class,
]

```

Also alias

```
'aliases' => [
    ...Others...,
    'FormStrap'   => Sukohi\FormStrap\Facades\FormStrap::class
]

```

Requirements
============

[](#requirements)

- [laravelcollective/html 5.0+](http://laravelcollective.com/docs/5.1/html)
- [BootStrap](http://getbootstrap.com/)

Usage(with blade)
=================

[](#usagewith-blade)

**Text**

```
{!! \FormStrap::text('name_1', 'text') !!}

```

**Label**

```
{!! \FormStrap::text('name_2', 'text')->label('LABEL_1') !!}

{!! \FormStrap::text('name_3', 'text')->label('LABEL_2', ['class' => 'text-danger']) !!}

{!! \FormStrap::text('name_4', 'text')->label('LABEL_3')->icon('', 'left') !!}

```

**Password**

```
{!! \FormStrap::password('name_9', $options = []) !!}

```

**Textarea**

```
{!! \FormStrap::textarea('name_10', 'Text', $options = []) !!}

```

**Radio Button(s)**

```
{!! \FormStrap::radio('name_11', ['value' => 'label'], 'checked_value', $options = []) !!}

{!! \FormStrap::radio('name_12', [
		'value_1' => 'label_1',
		'value_2' => 'label_2',
		'value_3' => 'label_3'
	], 'checked_value', $options = [], $separator = '&nbsp;') !!}

```

**Checkbox(es)**

```
{!! \FormStrap::checkbox('name_13', ['value' => 'label'], ['checked_value'], $options = []) !!}

{!! \FormStrap::checkbox('name_14', [
	'value_1' => 'label_1',
	'value_2' => 'label_2',
	'value_3' => 'label_3'
], [
	'checked_value_1',
	'checked_value_2'
], $options = [], $separator = '&nbsp;') !!}

```

**Select**

```
{!! \FormStrap::select('name_15', [
	'' => '',
	'value_1' => 'label_1',
	'value_2' => 'label_2',
	'value_3' => 'label_3'
], 'selected_value', $options = []) !!}

{!! \FormStrap::select('name_15_2', [
    '' => '',
    'value_1' => 'label_1',
    'value_2' => 'label_2',
    'value_3' => 'label_3'
], 'selected_value', $options = [], $redirect_url = 'http://example.com/{selected_value}') !!}

```

- When setting $redirect\_url, the select box has "onchange" event to redirect the url.
- {selected\_value} will be replaced with the value you selected.

**File**

```
{!! \FormStrap::file('name_16', $options = []) !!}

{!! \FormStrap::file('name_17')->multiple() !!}

{!! \FormStrap::file('name_18')->accept('image/*') !!}

```

**Hidden(s)**

```
{!! \FormStrap::hidden([
	'name_19' => 'value_1',
	'name_20' => 'value_2',
	'name_21' => 'value_3'
]) !!}

```

**Custom view**

```
{!! \FormStrap::view('name_22', 'custom.view', $parameters = []) !!}

```

**Submit**

```
{!! \FormStrap::submit('Submit ', ['class' => 'btn btn-success btn-sm']) !!}

{!! \FormStrap::submit('Submit', ['class' => 'btn btn-success btn-sm'])
		->cancel('url', 'CANCEL', ['class' => 'btn btn-default btn-sm']) !!}

{!! \FormStrap::submit('Submit')->cancel('url')->right() !!}

```

**Attribute Names for Validation (hidden tags)**

```
{!! \FormStrap::attributeNames($key = 'attribute_names') !!}

 or you can add/overwrite attributes using array.

{!! \FormStrap::attributeNames('attribute_names', [
    'attribute_1' => 'value_1',
    'attribute_2' => 'value_2',
    'attribute_3' => 'value_3'
]) !!}

```

and then in controller

```
$validator->setAttributeNames(Request::input('attribute_names'))

```

**Option Labels**

This way is to get selected labels of radio buttons, checkboxes and selectbox.
At first, set the following to generate hidden-tags in View.

```
{!! \FormStrap::optionLabels() !!}

// or you can use custom name with additional values

{!! \FormStrap::optionLabels('custom_hidden_name', [
    'key' => ['1' => 'value_1', '2' => 'value_2']
]) !!}

```

and then

```
$option_labels = \FormStrap::selectedOptionLabels('key');

```

**Alert**

When redirecting like this.

```
return back()->with('danger', 'Error occured!');

```

and then

```
{!! \FormStrap::alert('danger') !!}
{!! \FormStrap::alert('warning') !!}
{!! \FormStrap::alert('info', $dismissable = true) !!}
{!! \FormStrap::alert('success', false) !!}

// If you'd like to add icon(s)

{!! \FormStrap::alert()->icons([

	'danger' => ' ',
	'warning' => ' ',
	'primary' => ' ',
	'info' => ' '

]) !!}

```

(in this case, only the first one will be displayed. )
Also you can use array and empty that can cover all levels.

```
{!! \FormStrap::alert(['danger', 'warning']) !!}
{!! \FormStrap::alert() !!}

```

**Check if any alert exists**

```
@if(\FormStrap::hasAlert())
    Alert exists!
@endif

or

@if(\FormStrap::hasAlert(['danger', 'info']))
    Alert exists!
@endif

```

**CSS**

```
\FormStrap::css('input', 'your-class-name');  // for input-tag
\FormStrap::css('label', 'your-class-name');  // for label-tag
\FormStrap::css('group', 'your-class-name');  // for div-tag surrounding input and label
\FormStrap::css('content', 'your-class-name');  // for div-tag surrounding input

```

License
=======

[](#license)

This package is licensed under the MIT License.

Copyright 2014 Sukohi Kuhoh

###  Health Score

29

—

LowBetter than 57% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity68

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~10 days

Recently: every ~1 days

Total

7

Last Release

3971d ago

Major Versions

1.0.1 → 2.0.12015-08-14

### Community

Maintainers

![](https://www.gravatar.com/avatar/2980d59b309d45df3f2e6e51b1d336614da063240b8f76f873f287cd745ec5db?d=identicon)[Sukohi](/maintainers/Sukohi)

---

Top Contributors

[![SUKOHI](https://avatars.githubusercontent.com/u/5362394?v=4)](https://github.com/SUKOHI "SUKOHI (1 commits)")

### Embed Badge

![Health badge](/badges/sukohi-form-strap/health.svg)

```
[![Health](https://phpackages.com/badges/sukohi-form-strap/health.svg)](https://phpackages.com/packages/sukohi-form-strap)
```

###  Alternatives

[statamic-rad-pack/runway

Eloquently manage your database models in Statamic.

135224.7k7](/packages/statamic-rad-pack-runway)[api-platform/laravel

API Platform support for Laravel

58171.4k14](/packages/api-platform-laravel)[ecotone/laravel

Ecotone for Laravel — CQRS, Event Sourcing, Sagas, Durable Workflows, and Outbox on top of Laravel Queue, via PHP attributes.

21318.6k3](/packages/ecotone-laravel)[duncanmcclean/statamic-cargo

Comprehensive e-commerce addon for Statamic. Build bespoke e-commerce sites without the complexity.

3416.7k](/packages/duncanmcclean-statamic-cargo)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
