Download the PHP package laravie/html without Composer

On this page you can find all versions of the php package laravie/html. 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 html

Forms & HTML

tests Total Downloads Latest Stable Version Latest Unstable Version License

Installation

To install through composer, run the following command from terminal:

composer require "laravie/html"

Next, add your new provider to the providers array of config/app.php:

Finally, add two class aliases to the aliases array of config/app.php:

Looking to install this package in Lumen? First of all, making this package compatible with Lumen will require some core changes to Lumen, which we believe would dampen the effectiveness of having Lumen in the first place. Secondly, it is our belief that if you need this package in your application, then you should be using Laravel anyway.

Opening A Form

Opening A Form

By default, a POST method will be assumed; however, you are free to specify another method:

Note: Since HTML forms only support POST and GET, PUT and DELETE methods will be spoofed by automatically adding a _method hidden field to your form.

You may also open forms that point to named routes or controller actions:

You may pass in route parameters as well:

If your form is going to accept file uploads, add a files option to your array:

CSRF Protection

Adding The CSRF Token To A Form

Laravel provides an easy method of protecting your application from cross-site request forgeries. First, a random token is placed in your user's session. If you use the Form::open method with POST, PUT or DELETE the CSRF token will be added to your forms as a hidden field automatically. Alternatively, if you wish to generate the HTML for the hidden CSRF field, you may use the token method:

Attaching The CSRF Filter To A Route

Form Model Binding

Opening A Model Form

Often, you will want to populate a form based on the contents of a model. To do so, use the Form::model method:

Now, when you generate a form element, like a text input, the model's value matching the field's name will automatically be set as the field value. So, for example, for a text input named email, the user model's email attribute would be set as the value. However, there's more! If there is an item in the Session flash data matching the input name, that will take precedence over the model's value. So, the priority looks like this:

  1. Session Flash Data (Old Input)
  2. Explicitly Passed Value
  3. Model Attribute Data

This allows you to quickly build forms that not only bind to model values, but easily re-populate if there is a validation error on the server!

Note: When using Form::model, be sure to close your form with Form::close!

Form Model Accessors

Laravel's Eloquent Accessor allow you to manipulate a model attribute before returning it. This can be extremely useful for defining global date formats, for example. However, the date format used for display might not match the date format used for form elements. You can solve this by creating two separate accessors: a standard accessor, and/or a form accessor.

To define a form accessor, create a formFooAttribute method on your model where Foo is the "camel" cased name of the column you wish to access. In this example, we'll define an accessor for the date_of_birth attribute. The accessor will automatically be called by the HTML Form Builder when attempting to pre-fill a form field when Form::model() is used.

Labels

Generating A Label Element

Specifying Extra HTML Attributes

Note: After creating a label, any form element you create with a name matching the label name will automatically receive an ID matching the label name as well.

Text, Text Area, Password & Hidden Fields

Generating A Text Input

Specifying A Default Value

Note: The hidden and textarea methods have the same signature as the text method.

Generating A Password Input

Generating Other Inputs

Checkboxes and Radio Buttons

Generating A Checkbox Or Radio Input

Generating A Checkbox Or Radio Input That Is Checked

Number

Generating A Number Input

Date

Generating A Date Input

File Input

Generating A File Input

Note: The form must have been opened with the files option set to true.

Drop-Down Lists

Generating A Drop-Down List

Generating A Drop-Down List With Selected Default

Generating a Drop-Down List With an Empty Placeholder

This will create an <option> element with no value as the very first option of your drop-down.

Generating A Grouped List

Generating A Drop-Down List With A Range

Generating A List With Month Names

Buttons

Generating A Submit Button

Generating A Button

Note: Default value for third parameter is true. As default, any value that you pass will be escaped.

Custom Macros

Registering A Form Macro

It's easy to define your own custom Form class helpers called "macros". Here's how it works. First, simply register the macro with a given name and a Closure:

Now you can call your macro using its name:

Calling A Custom Form Macro

Custom Components

Registering A Custom Component

Custom Components are similar to Custom Macros, however instead of using a closure to generate the resulting HTML, Components utilize Laravel Blade Templates. Components can be incredibly useful for developers who use Twitter Bootstrap, or any other front-end framework, which requires additional markup to properly render forms.

Let's build a Form Component for a simple Bootstrap text input. You might consider registering your Components inside a Service Provider's boot method.

Notice how we reference a view path of components.form.text. Also, the array we provided is a sort of method signature for your Component. This defines the names of the variables that will be passed to your view. Your view might look something like this:

Custom Components can also be created on the Html facade in the same fashion as on the Form facade.

Providing Default Values

When defining your Custom Component's method signature, you can provide default values simply by giving your array items values, like so:

Calling A Custom Form Component

Using our example from above (specifically, the one with default values provided), you can call your Custom Component like so:

This would result in something like the following HTML output:

Generating URLs

link_to

Generate a HTML link to the given URL.

link_to_asset

Generate a HTML link to the given asset.

link_to_route

Generate a HTML link to the given named route.

link_to_action

Generate a HTML link to the given controller action.


All versions of html with dependencies

PHP Build Version
Package Version
Requires php Version ^7.2 || ^8.0
illuminate/http Version ^7.0 || ^8.0 || ^9.0
illuminate/routing Version ^7.0 || ^8.0 || ^9.0
illuminate/session Version ^7.0 || ^8.0 || ^9.0
illuminate/support Version ^7.0 || ^8.0 || ^9.0
illuminate/view Version ^7.0 || ^8.0 || ^9.0
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 laravie/html contains the following files

Loading the files please wait ....