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(5y ago)327MITPHPPHP ^7.3|^8.0

Since Jun 16Pushed 5y 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 yesterday

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 51% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity61

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

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

[moonshine/moonshine

Laravel administration panel

1.3k268.2k89](/packages/moonshine-moonshine)[laravel/ai

The official AI SDK for Laravel.

1.1k4.6M315](/packages/laravel-ai)[psalm/plugin-laravel

Psalm plugin for Laravel

3345.4M354](/packages/psalm-plugin-laravel)[tallstackui/tallstackui

TallStackUI is a powerful suite of Blade components that elevate your workflow of Livewire applications.

731189.9k16](/packages/tallstackui-tallstackui)[statikbe/laravel-filament-flexible-content-blocks

The Laravel Filament Flexible Content Blocks package helps you to easily create content in Filament for any model, with predefined or custom blocks, and foreach block an extendable Blade view component.

17927.9k6](/packages/statikbe-laravel-filament-flexible-content-blocks)[api-platform/laravel

API Platform support for Laravel

58190.1k21](/packages/api-platform-laravel)

PHPackages © 2026

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