PHPackages                             axn/laravelcollective-form-to-raw-html - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. axn/laravelcollective-form-to-raw-html

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

axn/laravelcollective-form-to-raw-html
======================================

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

2.2.0(10mo ago)31.7k1MITPHPPHP ^8.2

Since Apr 24Pushed 10mo ago2 watchersCompare

[ Source](https://github.com/AXN-Informatique/laravelcollective-form-to-raw-html)[ Packagist](https://packagist.org/packages/axn/laravelcollective-form-to-raw-html)[ Docs](https://github.com/AXN-Informatique/laravelcollective-form-to-raw-html)[ RSS](/packages/axn-laravelcollective-form-to-raw-html/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (8)Dependencies (2)Versions (10)Used By (0)

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::() !!}` or `{{ Form::() }}`, then analyzes arguments to determine the HTML tag attributes.

- [Installation](#installation)
- [Usage](#usage)

Installation
------------

[](#installation)

With Composer, as dev dependency:

```
composer require axn/laravelcollective-form-to-raw-html --dev
```

Usage
-----

[](#usage)

Simply run this command:

```
php artisan laravelcollective-form-to-raw-html:run
```

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

You can precise an other directory:

```
php artisan laravelcollective-form-to-raw-html:run resources/views/admin/users
```

Or a single file:

```
php artisan laravelcollective-form-to-raw-html:run resources/views/admin/users/create.blade.php
```

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

The supported methods are:

- open(options)
- close()
- label(name, value, options, escape)
- labelRequired(name, value, options, escape) **(AXN-Informatique macro)**
- hiddenForm(options) **(AXN-Informatique macro)**
- input(type, name, value, options)
- text(name, value, options)
- number(name, value, options)
- date(name, value, options)
- time(name, value, options)
- datetime(name, value, options)
- week(name, value, options)
- month(name, value, options)
- range(name, value, options)
- search(name, value, options)
- email(name, value, options)
- tel(name, value, options)
- url(name, value, options)
- color(name, value, options)
- hidden(name, value, options)
- checkbox(name, value, checked, options)
- radio(name, value, checked, options)
- file(name, options)
- password(name, options)
- textarea(name, value, options)
- select(name, list, selected, options)
- button(name, options)
- submit(name, options)

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

Warnings and limitations
------------------------

[](#warnings-and-limitations)

Escaped echo without double-encode
----------------------------------

[](#escaped-echo-without-double-encode)

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

```
e($value, false)
```

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

For example:

```

    {!! e('Name &amp; firstname', false) !!}

```

The HTML result will be:

```
&lt;strong&gt;Name &amp; firstname&lt;/strong&gt;
```

For simplicity and clarity purpose, this package use regular Blade echo syntax instead of escaped echo without double-encode.

If you want to keep the original behavior of LaravelCollective, use `--escape-without-double-encode` option to the command.

So instead of escaping this way:

```
{{ $value }}
```

The values ​​will be escaped like this:

```
{!! e($value, false) !!}
```

Automatically retrieve field value
----------------------------------

[](#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:

```
{!! Form::text('name') !!}
```

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:

```
{!! Form::text('name[0]') !!}
```

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.')`. 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
--------------------------------------------------------

[](#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:

```
{!! Form::checkbox('name[]') !!}
```

Will be replaced by:

```

```

If a default checked state is specify, for example:

```
{!! Form::checkbox('name[]', '1', true) !!}
```

It will appear like this:

```

```

Select with optgroup
--------------------

[](#select-with-optgroup)

The `Form::select` method accepts grouped arrays of options to render ``.

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
--------

[](#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:

```
{!! Form::text('name', null, [
    'class' => 'form-control',
    // 'required',
]) !!}
```

Will be replaced by:

```
{{-- @TODO CHECK COMMENTS: {!! Form::text('name', null, [
    'class' => 'form-control',
    // 'required',
]) !!} --}}

```

Not regular array syntax for options
------------------------------------

[](#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:

```
{!! Form::text('name', null,
    array_merge($defaultOptions, [
        'size' => 50,
        'required',
    ])
) !!}
```

Will be replaced by:

```
 50,
        'required',
    ]) --}}
>
```

Date fields
-----------

[](#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.

###  Health Score

40

—

FairBetter than 88% of packages

Maintenance54

Moderate activity, may be stable

Popularity24

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 66.7% 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 ~62 days

Recently: every ~94 days

Total

8

Last Release

309d ago

Major Versions

1.1.2 → 2.0.02025-05-21

### Community

Maintainers

![](https://www.gravatar.com/avatar/121384f0b2f969c933a358bb40d5cf97c85558c328e9778cb9bb60f3c6302379?d=identicon)[axn](/maintainers/axn)

---

Top Contributors

[![lgtaxn](https://avatars.githubusercontent.com/u/23211553?v=4)](https://github.com/lgtaxn "lgtaxn (14 commits)")[![forxer](https://avatars.githubusercontent.com/u/407917?v=4)](https://github.com/forxer "forxer (7 commits)")

---

Tags

formhtmllaravellaravel-packagelaravelcollective-htmlpackage

###  Code Quality

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/axn-laravelcollective-form-to-raw-html/health.svg)

```
[![Health](https://phpackages.com/badges/axn-laravelcollective-form-to-raw-html/health.svg)](https://phpackages.com/packages/axn-laravelcollective-form-to-raw-html)
```

###  Alternatives

[wireui/wireui

TallStack components

1.8k1.3M16](/packages/wireui-wireui)[livewire/volt

An elegantly crafted functional API for Laravel Livewire.

4195.3M84](/packages/livewire-volt)[ramonrietdijk/livewire-tables

Dynamic tables for models with Laravel Livewire

21147.4k](/packages/ramonrietdijk-livewire-tables)

PHPackages © 2026

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