Download the PHP package orchestra/html without Composer
On this page you can find all versions of the php package orchestra/html. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download orchestra/html
More information about orchestra/html
Files in orchestra/html
Package html
Short Description HTML Component for Orchestra Platform
License MIT
Homepage http://orchestraplatform.com/docs/latest/components/html/
Informations about the package html
HTML Component for Orchestra Platform
HTML Component extends the functionality of Illuminate\Html
with the extra functionality to including a chainable Form and Table builder. These set of functionality are the backbone in allowing extensions in Orchestra Platform to attach action to any existing form or table.
Version Compatibility
Laravel | HTML |
---|---|
5.5.x | 3.5.x |
5.6.x | 3.6.x |
5.7.x | 3.7.x |
5.8.x | 3.8.x |
6.x | 4.x |
7.x | 5.x |
8.x | 6.x |
Installation
To install through composer, run the following command from terminal:
Configuration
Next add the service provider in config/app.php
.
Aliases
You might want to add the following to class aliases in config/app.php
:
Usage
Orchestra\Html\HtmlBuilder
is a small improvement from Illuminate\Html\HtmlBuilder
.
Advise to use this only when manipulating HTML outside of view, otherwise it's better (and faster) to use html.
Create HTML
Create a HTML tag from within your libraries/extension using following code:
Will return <p>Some awesome information</p>
.
You can customize the HTML attibutes by adding third parameter.
Will return <p id="foo">Another awesomeness</p>
.
Raw HTML Entities
Mark a string to be excluded from being escaped.
Will return <a href="foo"><img src="foo.jpg"></a>
.
This also can be dynamically done via.
Decorate HTML
Decorate method allow developer to define HTML attributes collection as HTML::attributes
method, with the addition of including default attributes array as second parameter.
Will return array('class' => 'foo span5', 'id' => 'foo');
.
It also support replacement of default attributes if such requirement is needed.
Will return array('class' => 'foo bar');
, note that span5
is excluded when we give !span5
in the first parameter.
Forms
Creating forms couldn't be any easier using Orchestra's HTML package. Let's get started.
Creating a new Form
To create a new form, use the Form::of()
method. The first parameter is simply a string to define what the form is for:
Form Attributes
To customize your forms attributes, call the attributes($attributes)
method
on the FormGrid
instance:
Specifying the Form layout
To specify the layout of the form, call the layout($view)
method on the
FormGrid
instance:
Adding Fields
To add fields to our form, we'll pass in a closure into the second parameter, and call the fieldset()
method off of the
injected FormGrid. Here's an example:
Available Fields
Adding Labels to Fields
To add a label onto a form control, use the method label()
:
Adding Default Values to Fields
To add a default value to the field, use the method value()
on the form control:
Changing the submit button label
To change the submit button label, modify the FormGrid property submit
like so:
Customizing the form control attributes
To customize the form controls attributes, call the attributes($attributes)
method
on the control:
Customizing the form control itself
You could also create a Renderable
class:
And you can simply register it via:
Displaying your form
To display your form, simply display it in your view with unescaped blade tags:
All versions of html with dependencies
illuminate/translation Version ^8.40
illuminate/support Version ^8.40
laravie/html Version ^7.2
laravie/query-filter Version ^2.1
orchestra/contracts Version ^6.0
orchestra/support Version ^6.1