PHPackages                             bcdbuddy/portfolio-form - 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. bcdbuddy/portfolio-form

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

bcdbuddy/portfolio-form
=======================

A basic framework agnostic form building using materialize css framework package with a few extra niceties like remembering old input and retrieving error messages. Built on AdamWathan/BootForms

0213PHP

Since Dec 27Pushed 2y agoCompare

[ Source](https://github.com/bcdbuddy/portfolio-form)[ Packagist](https://packagist.org/packages/bcdbuddy/portfolio-form)[ RSS](/packages/bcdbuddy-portfolio-form/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

PortfolioForm
=============

[](#portfolioform)

[![Code Climate](https://camo.githubusercontent.com/6ae1f3621da67ee693868c0d9cd3ebdb7308db24d52f1f0023b900702adbebaa/68747470733a2f2f636f6465636c696d6174652e636f6d2f6769746875622f62636462756464792f706f7274666f6c696f2d666f726d2f6261646765732f6770612e737667)](https://codeclimate.com/github/bcdbuddy/portfolio-form)[![Coverage Status](https://camo.githubusercontent.com/0b56d0b1cf6c821087a1c287588a4c7eb283d051a2583dc13d1b8d2ee9063234/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f62636462756464792f706f7274666f6c696f2d666f726d2f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/r/bcdbuddy/portfolio-form?branch=master)

- [Installation](#installation)
- [Basic Usage](#basic-usage)
- [Using material icons](#using-material-icons)
- [Automatic Validation State](#automatic-validation-state)
- [Model Binding](#model-binding)
- [Different types](#different-types)
- [Advance usages](#advance-usages)
- [Todos](#todos)
- [Credits](#credits)
- [Licence](#licence)

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

[](#installation)

You can install this package via Composer by running this command in your terminal in the root of your project:

```
composer require bcdbuddy/portfolio-form
```

### Laravel

[](#laravel)

> This package works great as a replacement Form Builder that was removed in Laravel 5. The API is different but all of the features are there.

If you are using Laravel 4 or 5, you can register the FormServiceProvider to automatically gain access to the Old Input and Error Message functionality.

To do so, just update the `providers` array in your `config/app.php`:

```
'providers' => [
    //...
    'bcdbuddy\PortfolioForm\ServiceProvider'
],
```

You can also choose to use the Facade by adding an alias in `config/app.php`:

```
'aliases' => [
    //...
    'PortfolioForm' => 'bcdbuddy\PortfolioForm\Facades\PortfolioForm',
],
```

You can now start using MaterialForms by calling methods directly on the `PortfolioForm` facade:

```
PortfolioForm::email('Email', 'email');
PortfolioForm::text('First name', 'first_name');
PortfolioForm::password('Password', 'password');
```

### Outside of Laravel

[](#outside-of-laravel)

Usage outside of Laravel is a little trickier since there's a bit of a dependency stack you need to build up, but it's not too tricky.

```
$formBuilder = new bcdbuddy\PortfolioForm\FormBuilder;

$formBuilder->setOldInputProvider($myOldInputProvider);
$formBuilder->setErrorStore($myErrorStore);
$formBuilder->setToken($myCsrfToken);

$basicMaterialFormsBuilder = new bcdbuddy\MaterialForms\BasicFormBuilder($formBuilder);
$horizontalMaterialFormsBuilder = new bcdbuddy\MaterialForms\HorizontalFormBuilder($formBuilder);

$bootForm = new bcdbuddy\MaterialForms\PortfolioForm($basicMaterialFormsBuilder, $horizontalMaterialFormsBuilder);
```

> Note: You must provide your own implementations of `bcdbuddy\Form\OldInputInterface` and `bcdbuddy\Form\ErrorStoreInterface` when not using the implementations meant for Laravel.

Basic Usage
-----------

[](#basic-usage)

MaterialForms lets you create a label and form control and wrap it all in a form group in one call.

```
//
//
//      Field Label
//
//
//
{!! PortfolioForm::open() !!}
    {!! PortfolioForm::text('Field Label', 'field_name') !!}
{!! PortfolioForm::close() !!}
```

> Note: Don't forget to `open()` forms before trying to create fields!

### Customizing Elements

[](#customizing-elements)

If you need to customize your form elements in any way (such as adding a default value or placeholder to a text element), simply chain the calls you need to make and they will fall through to the underlying form element.

Attributes can be added either via the `attribute` method, or by simply using the attribute name as the method name.

```
//
//
//    First Name
//
PortfolioForm::text('First Name', 'first_name')->placeholder('John Doe');

//
//
//     Red
//     Green
//
//   Color
//
PortfolioForm::select('Color', 'color')->options(['red' => 'Red', 'green' => 'Green'])->select('green');

//
PortfolioForm::open()->get()->action('/users');

//
//    First Name
//
//
PortfolioForm::text('First Name', 'first_name')->defaultValue('John Doe');
```

Using material icons
--------------------

[](#using-material-icons)

```
PortfolioForm::open()->post()->action('/posts/'. $post->id);
    PortfolioForm::bind($post)
    PortfolioForm::text("Title", "title")
    PortfolioForm::textarea("Content", "content")
    PortfolioForm::submit("Save")->icon('save')
PortfolioForm::close()
```

or

```
PortfolioForm::open()->post()->action('/user/login');
    PortfolioForm::text("Login", "login")->icon("account_circle")
    PortfolioForm::password("Password", "password")->icon("security")
    PortfolioForm::submit("Login")->icon('')
PortfolioForm::close()
```

### Reduced Boilerplate

[](#reduced-boilerplate)

Typical Materialize form boilerplate might look something like this:

```

    First Name

    Last Name

    Date of Birth

    Email address

    Password

  Submit

```

MaterialForms makes a few decisions for you and allows you to pare it down a bit more:

```
{!! PortfolioForm::open() !!}
  {!! PortfolioForm::text('First Name', 'first_name') !!}
  {!! PortfolioForm::text('Last Name', 'last_name') !!}
  {!! PortfolioForm::date('Date of Birth', 'date_of_birth') !!}
  {!! PortfolioForm::email('Email', 'email') !!}
  {!! PortfolioForm::password('Password', 'password') !!}
  {!! PortfolioForm::submit('Submit') !!}
{!! PortfolioForm::close() !!}
```

### Automatic Validation State

[](#automatic-validation-state)

Another nice thing about MaterialForms is that it will automatically add error states and error messages to your controls if it sees an error for that control in the error store.

Essentially, this takes code that would normally look like this:

```

  First Name

```

And reduces it to this:

```
{!! PortfolioForm::text('First Name', 'first_name') !!}
```

...with the `data-error` class being added automatically if there is an error in the session.

### Model Binding

[](#model-binding)

MaterialForms makes it easy to bind an object to a form to provide default values. Read more about it [here](https://github.com/bcdbuddy/form#model-binding).

```
PortfolioForm::open()->action( route('users.update', $user) )->put()
PortfolioForm::bind($user)
PortfolioForm::close()
```

Different types
---------------

[](#different-types)

```
    {!! PortfolioForm::text("Field label", "field_name") !!}
    {!! PortfolioForm::textarea("Field label", "field_name") !!}
    {!! PortfolioForm::email("Field label", "field_name") !!}
    {!! PortfolioForm::password("Field label", "field_name") !!}
    {!! PortfolioForm::file("Field label", "field_name") !!}
    {!! PortfolioForm::checkbox("Field label", "field_name") !!}
    {!! PortfolioForm::datetime("Field label", "field_name") !!}
    {!! PortfolioForm::date("Field label", "field_name") !!}
    {!! PortfolioForm::time("Field label", "field_name") !!}

```

Advance usages
--------------

[](#advance-usages)

```
{!! PortfolioForm::open() !!}
    {!! PortfolioForm::text("Last name", "last_name") !!}
    {!! PortfolioForm::email("Email", "email") !!}
    {!! PortfolioForm::password("Password", "password") !!}
    {!! PortfolioForm::file("File", "file")->placeholder("some file to upload") !!}
    {!! PortfolioForm::checkbox("Remember", "remember")->checked() !!}
    {!! PortfolioForm::checkbox("HTML", "html")->disabled()->checked() !!}
    {!! PortfolioForm::checkbox("Remember filled-in", "remember filled-in")->addClass("filled-in")->checked() !!}
    {!! PortfolioForm::checkbox("Safe", "safe")->addClass("filled-in")->disabled()->checked() !!}
    {!! PortfolioForm::checkbox("Save", "save")->addClass("filled-in")->disabled()!!}
    {!! PortfolioForm::switchCheck("On", "Off", "state") !!}
    {!! PortfolioForm::select("One Select", "one_select", ["1", "2", "5", "10"]) !!}
    {!! PortfolioForm::select("One icon Select", "one_icon_select", ["1", "2", "5", "10"], ["http://lorempicsum.com/futurama/350/200/1", "http://lorempicsum.com/futurama/350/200/2", "http://lorempicsum.com/futurama/350/200/5", "http://lorempicsum.com/futurama/350/200/6"])->left() !!} // or right()
    {!! PortfolioForm::submit("Send")->icon("send") !!}
{!! PortfolioForm::close() !!}
```

Output
------

[](#output)

[![result](output.png)](output.png)

Todos
-----

[](#todos)

- radio input
- switch input
- file input

Credits
-------

[](#credits)

- [Adam Wathan BootForms](https://github.com/adamwathan/bootforms)

Licence
-------

[](#licence)

[MIT](LICENSE)

###  Health Score

15

—

LowBetter than 3% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity20

Early-stage or recently created project

 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/01c532a84d1a5cdcf704cbb3a90e32a831bf7a427b3a1aa0baf8bebdfafbbec9?d=identicon)[bcdbuddy](/maintainers/bcdbuddy)

---

Top Contributors

[![babacarcissedia](https://avatars.githubusercontent.com/u/17571380?v=4)](https://github.com/babacarcissedia "babacarcissedia (3 commits)")

### Embed Badge

![Health badge](/badges/bcdbuddy-portfolio-form/health.svg)

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

###  Alternatives

[shaozeming/aliyun-sts

基于阿里云openapi系列接口中STS最新版本的SDK进行封装的composer package

2021.0k1](/packages/shaozeming-aliyun-sts)

PHPackages © 2026

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