Download the PHP package axn/laravelcollective-form-to-raw-html without Composer

On this page you can find all versions of the php package axn/laravelcollective-form-to-raw-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 laravelcollective-form-to-raw-html

LaravelCollective Form To Raw Html

Provides Artisan command to replace LaravelCollective Form:: syntax by raw HTML

It searches for {!! Form::<method>(<arguments>) !!} or {{ Form::<method>(<arguments>) }}, then analyzes arguments to determine the HTML tag attributes.

Installation

With Composer, as dev dependency:

Usage

Simply run this command:

By default, the command scans all files in resources/views/.

You can precise an other directory:

Or a single file:

NOTE: The target path is always relative to the project root.

The supported methods are:

If a method is not supported, there is no replacement.

Warnings and limitations

Escaped echo without double-encode

LaravelCollective internally use most of the time escaped echo without double-encode:

This prevents the encoded HTML entities from being encoded a second time (&amp; => &amp;amp;)

So, you will see the use of this function in the replacement to keep the original behavior.

For example:

The HTML result will be:

Escaped with double-encode

If you do not want to use this feature you can pass the --escape-with-double-encode option to the command.

So instead of escaping this way:

The values ​​will be escaped like this:

Automatically retrieve field value

LaravelCollective has a complex method to automatically retrieve the value of the field: it searches in "old" values and in the request. You can see it in the getValueAttribute method of the FormBuilder class.

This was to complex to implement entirely, so the converter only handles the value retrieving from the "old" values.

For example:

Will be replaced by:

If you have fields with name as array, the converter will replace the array syntax by dot syntax for the old helper like LaravelCollective do.

For example:

Will be replaced by:

If you already used old helper in the Form:: syntax, the converter will detect it and not doubling the use of the "old" helper.

WARNING 1: If a part of the name is in a variable (for example Form::text('name['.$index.']')), the converter will integrate the replacement function into the output result like this:

WARNING 2: If you have fields with name as array but with no explicit key (for example name[]), the converter cannot determine what index to use to get the proper value and will simply render old('name') instead of old('name.<index>'). You may need to check these cases to manually set the proper way to retrieve the value (for example: old('name.0')).

Automatically determine radio and checkbox checked state

Like for value retrieving, the converter only handles the checked state retrieving from the "old" values. It uses in_array in case where the "old" value is multiple.

For example:

Will be replaced by:

If a default checked state is specify, for example:

It will appear like this:

Select with optgroup

The Form::select method accepts grouped arrays of options to render <optgroup>.

This feature was to complex to implement: this would have required to add to much code in the HTML replacement whose will be not needed 99% of the time (unless you heavy used optgroups). The converter cannot detect if the list argument contains groups so it is not possible to detect cases where optgroups are used. You may need to manually review these cases.

However, the converter can detect if optionsAttributes or optgroupsAttributes arguments of Form::builder have been used. If so, the corresponding Form::select will not be replaced.

Comments

If there are comments in the original syntax, the converter will erase these but the original syntax will be preserve in a comment for manual check. You can retrieve these cases by searching for @TODO CHECK COMMENTS.

For example:

Will be replaced by:

Not regular array syntax for options

If the options argument is not a regular array, the converter will process the replacement of the Form:: syntax but will preserve the options in a comment for manual check and manual replacements of the HTML tag attributes. You can retrieve these cases by searching for @TODO CHECK OPTIONS.

For example:

Will be replaced by:

Date fields

LaravelCollective date, time, datetime, week and month methods support a DateTime instance as value and format this internally. The converter cannot detect the value type so you may need to review these cases if DateTime instances have been used as value argument of these methods.


All versions of laravelcollective-form-to-raw-html with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
laravel/framework Version ^10.0 || ^11.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 axn/laravelcollective-form-to-raw-html contains the following files

Loading the files please wait ....