PHPackages                             bnhashem/form-data - 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. [Templating &amp; Views](/categories/templating)
4. /
5. bnhashem/form-data

ActiveLibrary[Templating &amp; Views](/categories/templating)

bnhashem/form-data
==================

Make your database columns available in your blade view effortlessly

v2.0.0(4y ago)327MITPHPPHP ^7.3|^8.0

Since Jun 16Pushed 4y ago2 watchersCompare

[ Source](https://github.com/BNhashem16/form-data)[ Packagist](https://packagist.org/packages/bnhashem/form-data)[ Docs](https://github.com/bnhashem16/form-data)[ GitHub Sponsors](https://github.com/bnhashem)[ RSS](/packages/bnhashem-form-data/feed)WikiDiscussions main Synced 3d ago

READMEChangelog (3)Dependencies (4)Versions (6)Used By (0)

FormData Package
================

[](#formdata-package)

Make your database columns available in your blade view effortlessly.

[![Latest Version on Packagist](https://camo.githubusercontent.com/46dc20a8dbf08c747150a9d2dc4b8322dfad9db1efc11b6407b805ecdb7356a1/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f626e68617368656d2f666f726d2d646174612e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/bnhashem/form-data)[![Total Downloads](https://camo.githubusercontent.com/e3fb3f8fe16f64c911f695ced66433cce540362f6dec077da1d32df3d98fbcf3/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f626e68617368656d2f666f726d2d646174612e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/bnhashem/form-data)

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

[](#installation)

You can install the package via composer:

```
composer require bnhashem/form-data
```

Features
--------

[](#features)

- Incredibly easy to use.
- Help use signle form for create and update.
- The values name are the same as the database columns name, save you calling `old` conditionally in the view.

```
use Bnhashem\FormData\FormData;

$formData = new FormData();
```

Usage
-----

[](#usage)

Create
------

[](#create)

```
use Bnhashem\FormData\FormData;

/**
 * Show the form for creating a new resource.
 *
 * @return \Illuminate\Http\Response
 */
public function create()
{
    return view('your.custom.view', FormData::old(new Model()));
}
```

Edit
----

[](#edit)

```
use Bnhashem\FormData\FormData;

/**
 * Show the form for editing the specified resource.
 *
 * @param  \App\Models\Model $model
 * @return \Illuminate\Http\Response
 */

public function edit(Model $model)
{
    return view('your.custom.view', FormData::edit($model);
}
```

Example
=======

[](#example)

```
/**
 * Run the migrations.
 *
 * @return void
 */
public function up()
{
    Schema::create('posts', function (Blueprint $table) {
        $table->id();
        $table->string('name');
        $table->string('content');
        $table->timestamps();
    });
}
```

We will try to store a new post
-------------------------------

[](#we-will-try-to-store-a-new-post)

```
use Bnhashem\FormData\FormData;

public function create()
{
    return view('your.custom.view', FormData::old(new Post()));
}
```

Mind that the name of variable must be the same as the column name value in the database

```

    {{ __('Name') }}

    @error('name') {{ $message }} @enderror

```

We will try to edit a post
--------------------------

[](#we-will-try-to-edit-a-post)

```
use Bnhashem\FormData\FormData;

public function edit(Post $post)
{
    return view('your.custom.view', FormData::edit($post));
}
```

```

    {{ __('Name') }}

    @error('name') {{ $message }} @enderror

```

Json Columns
============

[](#json-columns)

> Somtimes Column have many values and unique keys, in this case We will do the following:

#### posts table migration

[](#posts-table-migration)

```
public function up()
{
    Schema::create('posts', function (Blueprint $table) {
        $table->id();
        $table->json('name');
        $table->json('content');
    });
}
```

#### Post Model

[](#post-model)

Add static property `$JSONCOLUMNS`, with column names and the the keys that you want to add in the blade.

```
namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class Post extends Model
{

    public static $JSONCOLUMNS = [
        'name' => ['en', 'ar'],
        'content' => ['ar', 'en']
        ];

}
```

#### Fetch Data From Json columns in blade

[](#fetch-data-from-json-columns-in-blade)

```

    {{ __('English Name') }}

    @error('name.en') {{ $message }} @enderror

    {{ __('Arabic Name') }}

    @error('name.ar') {{ $message }} @enderror

```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](.github/CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [Ahmed Mohamed Hashem](https://github.com/BNhashem16)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor1

Top contributor holds 60% 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 ~1 days

Total

4

Last Release

1791d ago

Major Versions

v1.0.2 → v2.0.02021-06-18

PHP version history (2 changes)v1.0.0PHP ^8.0

v2.0.0PHP ^7.3|^8.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/40724217?v=4)[Ahmed Mohamed salah](/maintainers/bnhashem)[@bnhashem](https://github.com/bnhashem)

---

Top Contributors

[![BNhashem16](https://avatars.githubusercontent.com/u/49618985?v=4)](https://github.com/BNhashem16 "BNhashem16 (6 commits)")[![nagi1](https://avatars.githubusercontent.com/u/16584220?v=4)](https://github.com/nagi1 "nagi1 (4 commits)")

---

Tags

laravelform-databnhashem

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/bnhashem-form-data/health.svg)

```
[![Health](https://phpackages.com/badges/bnhashem-form-data/health.svg)](https://phpackages.com/packages/bnhashem-form-data)
```

###  Alternatives

[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9682.1M97](/packages/roots-acorn)[moonshine/moonshine

Laravel administration panel

1.3k217.1k59](/packages/moonshine-moonshine)[ryangjchandler/blade-capture-directive

Create inline partials in your Blade templates with ease.

8222.2M12](/packages/ryangjchandler-blade-capture-directive)[spatie/laravel-blade-comments

Add debug comments to your rendered output

177325.5k](/packages/spatie-laravel-blade-comments)[radic/blade-extensions

Laravel package providing additional Blade extensions: foreach (with $loop data like twig), break, continue, set,array (multiline), etc

271321.7k5](/packages/radic-blade-extensions)[andreia/filament-nord-theme

A minimalist Arctic Nord theme for FilamentPHP

13334.7k2](/packages/andreia-filament-nord-theme)

PHPackages © 2026

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