PHPackages                             erdemozveren/laravelmacros - 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. erdemozveren/laravelmacros

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

erdemozveren/laravelmacros
==========================

Laravel helper macros for your project

v0.3.2(5y ago)04MITPHPPHP ^7.1.3CI failing

Since Jul 24Pushed 5y ago2 watchersCompare

[ Source](https://github.com/erdemozveren/laravelmacros)[ Packagist](https://packagist.org/packages/erdemozveren/laravelmacros)[ Docs](https://github.com/erdemozveren/laravelmacros)[ RSS](/packages/erdemozveren-laravelmacros/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependencies (5)Versions (6)Used By (0)

laravelmacros
=============

[](#laravelmacros)

[![Latest Version on Packagist](https://camo.githubusercontent.com/257099a1af68c7206b96c8243674fdc2d57e3bc10f160657f069cd4e737834d5/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f657264656d6f7a766572656e2f4c61726176656c4d6163726f732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/erdemozveren/LaravelMacros)[![Total Downloads](https://camo.githubusercontent.com/0b518caf635179d4fd4fe052dc4ed362eead557714e12878ffe266042be60ef2/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f657264656d6f7a766572656e2f4c61726176656c4d6163726f732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/erdemozveren/LaravelMacros)[![Build Status](https://camo.githubusercontent.com/559814da1de721802aca41546bd8a3c49ac8001d38650bfd4a1712ec917fb7c8/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f657264656d6f7a766572656e2f4c61726176656c4d6163726f732f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/erdemozveren/LaravelMacros)[![StyleCI](https://camo.githubusercontent.com/cb13a877afd1dbe223c631789c3f922d3ace958fdb334a9cce9b26afefbc2ebd/68747470733a2f2f7374796c6563692e696f2f7265706f732f31323334353637382f736869656c64)](https://styleci.io/repos/12345678)

I'm lazy,so i made package with some handful shourtcuts for Laravel.

> Compatibility:Laravel 5.8+ , Not stable for production

- [Installation](#installation)
- [Getting Started](#getting-started)

### Usage

[](#usage)

- [Form Builder](#form-builder)
- [Generate Form](#generate-form)
- [Auto generate form fields](#auto-generate-form-fields)
- [Form Macros](#form-macros)

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

[](#installation)

Via Composer

```
$ composer require erdemozveren/laravelmacros
```

For customization, first publish config file

```
$ php artisan vendor:publish --provider="erdemozveren\laravelmacros\LaravelMacrosServiceProvider" --tag=config
```

Now you can edit default configuration for inputs,settings etc.

Getting Started
---------------

[](#getting-started)

`laravelmacros` aims to build simple skeleton for forms and form proccess easy To getting started add in your model `use erdemozveren\laravelmacros\Traits\FormBuilderTrait;` then in class use it as trait `use FormBuilderTrait;` now you ready to continue!

this package add Laravel collective macros to get things easier,you can use it by just simply add "c" to start and Upper case next letter,like this;

`Form::text('email', 'example@gmail.com') --> Form::cText('email', 'example@gmail.com')`

Usage
-----

[](#usage-1)

### Form Builder

[](#form-builder)

add formFields function to model

```
public function formFields() {
    return [
        "*"=>[ // wildcard will be applied to all elements
            "options"=>
            ["style"=>"color:red!important"]
        ],
        "parent_id"=>[ // "parent_id" is the name attribute
            "type"=>"select", // input type (e.g. "select" will look for "cSelect")
            "label"=>"Parent", // label text
            "data"=>User::pluck('full_name','id'), // [ONLY FOR select] you can write any data source that laravel collective accepts
            "options"=>[ // optional
                "required"=>false // optional make input optional
                // ... and other "laravel collective" options and dom parameters can be used in here
            ]
        ],
        "full_name"=>[
            "type"=>"text",
            "label"=>"Full Name",
        ],
        "email"=>[
            "type"=>"text",
            "label"=>"E-mail",
        ],
        "password"=>[
            "type"=>"password",
            "label"=>"Password",
        ],
    ];
}
```

### Generate Form

[](#generate-form)

In your blade file you can use like this

```
{!!Form::model($model,['url'=>"/post"])!!}
{!!$model->generateForm()!!}
{!!Form::cSubmit()!!}
{!!Form::close()!!}
```

or

```
{!!Form::open(['url'=>"/post"])!!}
{!!$model->generateForm()!!}
{!!Form::cSubmit()!!}
{!!Form::close()!!}
```

if you want to exclude one or more elements in one form just pass option `_exclude` with array of fields name

```
{!!$model->generateForm(["_exclude"=>["full_name","another_filed_name"]])!!}
```

### Auto generate form fields

[](#auto-generate-form-fields)

```
$ php artisan laravelmacros:formfields {tablename}
```

it will ask you some questions then give you `formFields` function code to copy into model file [![](wiki/autogenerate.gif)](wiki/autogenerate.gif)

### Form Macros

[](#form-macros)

These macros extended from `laravel collective` and can be used in model binding too.

Value of the input will be (in order) ;

1. Session Flash Data ([Old Input](https://laravel.com/docs/requests#old-input))
2. Data From Current [Request](https://laravel.com/docs/requests) (via `Request::input` method)
3. Explicitly Passed Value
4. Model Attribute Data

```
// variable names stand for paramaters with default values

Form::cText($name,$label,$placeholder=null,$options=[]);

Form::cColor($name,$label,$options=[]);

Form::cTextarea($name,$label,$placeholder=null,$options=[]);

Form::cNumber($name,$label,$options=[]);

Form::cEmail($name,$label,$placeholder=null,$options=[]);

Form::cPassword($name,$label,$placeholder="*******",$options=[]);

Form::cFile($name,$label,$options=[]);

Form::cCheckbox($name,$label,$value=1,$checked=null);

Form::cRadio($name,$label,$value,$checked=null);

Form::cSubmit($label="Submit",$class="");

Form::cSelect($name,$label,$data,$options=[]);
```

Change log
----------

[](#change-log)

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

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

[](#contributing)

Please see [contributing.md](contributing.md) for details and a todolist.

Security
--------

[](#security)

If you discover any security related issues, please email author email instead of using the issue tracker.

Credits
-------

[](#credits)

- [Erdem Özveren](https://github.com/erdemozveren)
- [All Contributors](../../contributors)

License
-------

[](#license)

MIT

###  Health Score

21

—

LowBetter than 19% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity3

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity47

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

Every ~88 days

Total

5

Last Release

2131d ago

### Community

Maintainers

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

---

Top Contributors

[![erdemozveren](https://avatars.githubusercontent.com/u/16868544?v=4)](https://github.com/erdemozveren "erdemozveren (24 commits)")

---

Tags

form-builderlaravellaravelmacroformbuilder

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/erdemozveren-laravelmacros/health.svg)

```
[![Health](https://phpackages.com/badges/erdemozveren-laravelmacros/health.svg)](https://phpackages.com/packages/erdemozveren-laravelmacros)
```

###  Alternatives

[webpatser/laravel-uuid

Laravel integration for webpatser/uuid - High-performance drop-in UUID replacements (15% faster than Ramsey). Provides Str macros, HasUuids trait, facades, and casts. RFC 4122/9562 compliant.

1.8k17.3M129](/packages/webpatser-laravel-uuid)[barryvdh/laravel-form-bridge

This packages integrates Symfony Form Component in Laravel.

163354.8k1](/packages/barryvdh-laravel-form-bridge)[caouecs/sirtrevorjs

Sir Trevor JS in Laravel project

5421.6k](/packages/caouecs-sirtrevorjs)[rinvex/laravel-menus

Rinvex Menus is a simple menu builder package for Laravel, that supports hierarchical structure, ordering, and styling with full flexibility using presenters for easy styling and custom structure of menu rendering.

294.0k20](/packages/rinvex-laravel-menus)[efficiently/jquery-laravel

This package provides jQuery and the jQuery-ujs driver for your Laravel &gt;= 6 application.

1311.0k1](/packages/efficiently-jquery-laravel)

PHPackages © 2026

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