Download the PHP package sukohi/form-strap without Composer

On this page you can find all versions of the php package sukohi/form-strap. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package form-strap

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)

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

Usage(with 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('<i class="fa fa-home"></i>', '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}') !!}

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 <i class="fa fa-home"></i>', ['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' => '<i class="fa fa-***"></i> ', 
    'warning' => '<i class="fa fa-***"></i> ', 
    'primary' => '<i class="fa fa-***"></i> ', 
    'info' => '<i class="fa fa-***"></i> '

]) !!}

(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

This package is licensed under the MIT License.

Copyright 2014 Sukohi Kuhoh


All versions of form-strap with dependencies

PHP Build Version
Package Version
Requires php Version >=5.4.0
illuminate/support Version 4.2.*
sukohi/form-strap Version 1.*
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package sukohi/form-strap contains the following files

Loading the files please wait ....