PHPackages                             kalshah/laravel-validation-html-attributes - 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. [Validation &amp; Sanitization](/categories/validation)
4. /
5. kalshah/laravel-validation-html-attributes

ActiveLibrary[Validation &amp; Sanitization](/categories/validation)

kalshah/laravel-validation-html-attributes
==========================================

Use laravel backend validation rules as html validation attributes.

0.0.1(4y ago)19121MITPHP

Since Aug 5Pushed 4y ago2 watchersCompare

[ Source](https://github.com/KhawlahElshah/laravel-validation-html-attributes)[ Packagist](https://packagist.org/packages/kalshah/laravel-validation-html-attributes)[ RSS](/packages/kalshah-laravel-validation-html-attributes/feed)WikiDiscussions main Synced yesterday

READMEChangelog (1)Dependencies (2)Versions (2)Used By (0)

Introduction
------------

[](#introduction)

This package comes up with an easy, smart way to pass laravel validation rules to html form and use it as client side validation.

---

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

[](#installation)

This Package can be installed via Composer

```
composer require kalshah/laravel-validation-html-attributes
```

How it works
------------

[](#how-it-works)

The core work is done in a trait `WithHtmlAttributes` which can be used in two ways:

1- First by using the package request `LaravelValidationToHtmlAttributesRequest` which uses this trait, this suits you if you are validating request in controller methods

```
    public function create(LaravelValidationToHtmlAttributesRequest $request)
    {
        $request->setRules([
            'first_name' => 'required'
        ]);

        return view('form', ['attributes' => $request->htmlAttributes()]);
    }
```

2- Second by using the `WithHtmlAttributes` in your **FormRequest**

```
    use WithHtmlAttributes;
```

and in your controller you can pass the attributes like so:

```
    public function create()
    {
        return view('form', ['attributes' => (new WithHtmlAttributesFormRequest())->htmlAttributes()]);
    }
```

and in the blade files you can access these attributes and add them on html form inputs, like so:

```
first_name }}>
```

and lets assume the laravel validation rules of this field `first_name` were

```
return ['first_name' => 'required|min:2|string'];
```

the returned html validation inputs will be

```

```

as we can see the trait converted laravel validation rules to valid html validation attributes.

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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

Unknown

Total

1

Last Release

1741d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/e92304a8bf2520f5be557e2a05b5039fda24c4d5cd0349c01096dc3fbacf24d8?d=identicon)[KhawlahElshah](/maintainers/KhawlahElshah)

---

Top Contributors

[![KhawlahElshah](https://avatars.githubusercontent.com/u/31843646?v=4)](https://github.com/KhawlahElshah "KhawlahElshah (9 commits)")

---

Tags

laravel-validationhtml validation attributes

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/kalshah-laravel-validation-html-attributes/health.svg)

```
[![Health](https://phpackages.com/badges/kalshah-laravel-validation-html-attributes/health.svg)](https://phpackages.com/packages/kalshah-laravel-validation-html-attributes)
```

###  Alternatives

[spatie/laravel-honeypot

Preventing spam submitted through forms

1.6k6.0M60](/packages/spatie-laravel-honeypot)[proengsoft/laravel-jsvalidation

Validate forms transparently with Javascript reusing your Laravel Validation Rules, Messages, and FormRequest

1.1k2.3M49](/packages/proengsoft-laravel-jsvalidation)[wendelladriel/laravel-validated-dto

Data Transfer Objects with validation for Laravel applications

759569.4k13](/packages/wendelladriel-laravel-validated-dto)[galahad/laravel-addressing

Laravel package providing addressing functionality

70316.6k](/packages/galahad-laravel-addressing)[bayareawebpro/laravel-multistep-forms

Responsable MultiStep Form Builder for Laravel.

967.9k](/packages/bayareawebpro-laravel-multistep-forms)[bllim/laravalid

This package makes validation rules defined in laravel work client-side by converting to html/js plugins such as jquery validation. It also allows to use laravel validation messages so you can show same messages for both sides.

5915.2k](/packages/bllim-laravalid)

PHPackages © 2026

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