PHPackages                             milkyway-multimedia/ss-zen-forms - 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. milkyway-multimedia/ss-zen-forms

ActiveSilverstripe-module[Templating &amp; Views](/categories/templating)

milkyway-multimedia/ss-zen-forms
================================

Allow you to decorate Silverstripe Forms before displaying, adding extra functionality

0.1(10y ago)6711[2 PRs](https://github.com/milkyway-multimedia/ss-zen-forms/pulls)MITPHP

Since Oct 26Pushed 9y ago2 watchersCompare

[ Source](https://github.com/milkyway-multimedia/ss-zen-forms)[ Packagist](https://packagist.org/packages/milkyway-multimedia/ss-zen-forms)[ RSS](/packages/milkyway-multimedia-ss-zen-forms/feed)WikiDiscussions master Synced 1mo ago

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

Zen Forms
=========

[](#zen-forms)

Still in heavy development
--------------------------

[](#still-in-heavy-development)

Due to some limitations, this may not work the way I want it, so the API will be changing frequently until I am happy with it. Please use with caution if you must use it at all.

**Zen Forms** is a module that allows changes on Silverstripe Forms and Validators using the decorator pattern. Name stolen from some other awesome Silverstripe Developers @sheadawson and @unclecheese

#### Decorator Pattern?

[](#decorator-pattern)

The decorator pattern works by wrapping other objects in with new methods, simply by passing them as the constructor. You can wrap as many decorators as you like around the same object. It is also great for separating some of your logic from your model, so model classes don't get cluttered.

An example of this within the Silverstripe Framework is the way the SS\_ListDecorator works.

You could use this pattern in more than just a form. You could wrap DataObjects who only need temporary functionality that you can easily inject/change without changing the underlying model class.

#### Why not just use extensions?

[](#why-not-just-use-extensions)

Extensions are great, but sometimes not every Object will need that extension (for example, I wouldn't need a form within the CMS to use Twitter Bootstrap templates and functionality).

Decorators work on a **per instance** rather than on a **per class** basis, and sometimes that is what you really need.

If you prefer the extensions version, unclecheese offers the **bootstrap-form extension by @unclecheese**.

#### Why does this use zen validator?

[](#why-does-this-use-zen-validator)

The default Silverstripe validator does not support JS validation at this stage, so I use the zen validator by @sheadawson. I have included some constraints that work nicely with the FormFieldBootstrapper decorator.

Install
-------

[](#install)

Add the following to your composer.json file

```

    "require"          : {
		"milkyway-multimedia/silverstripe-zen-forms": "dev-master"
	}

```

Usage
-----

[](#usage)

It is quite simple to use and easy to make your own. For example, if you would like a Form confirming to the Twitter Bootstrap layout scheme, you would do the following when defining your form:

```

    // $form now has FormBootstrapper methods attached, as well as the underlying form methods
    $form = new FormBootstrapper(new Form($controller, $name, $fields, $actions));

```

You can also wrap as many as you need to:

```

    $form = new ModaliseForm(new FormBootstrapper(new Form($controller, $name, $fields, $actions)));

```

Below are some of the decorators that come with the module. There is more documentation for each one in the docs/ folder

### For Forms

[](#for-forms)

1. [FormBoostrapper](docs/en/FormBoostrapper.md): Set your form to use the Twitter Bootstrap Template scheme. This has a lot of code from UncleCheese's module. If you use this, the field list is automatically decorated as well.
2. ModaliseForm: Set your form to display in a Modal.

### For Field Lists

[](#for-field-lists)

1. FieldListBootstrapper: Set your field list to use the Twitter Bootstrap Template scheme. This has a lot of code from UncleCheese's module. If you use this, the fields are automatically decorated as well.

### For Fields

[](#for-fields)

1. [FormFieldBoostrapper](docs/en/FormFieldBoostrapper.md): Set your field to use the Twitter Bootstrap Template scheme. This has a lot of code from UncleCheese's module.
2. CompositeFormFieldBootstrapper: If you are using a composite field with actions linked to one of its children fields, you will need to use this decorator. It is automatically used when necessary with the FormBootstrapper and FieldListBootstrapper.

To make your own, you can simply extend the specific Decorator, the BaseDecorator or implement \\Milkyway\\ZenForms\\Contracts\\Decorator.

```

    class TreatDataObjectSpecial extends BaseDecorator {
        // Do something special with the decorator, and you can refer to original object using $this->original();
    }

    class TreatFormFieldSpecial extends FormFieldDecorator {
        // Do something special with the decorator, and you can refer to original object using $this->original();
    }

```

Constraints
-----------

[](#constraints)

This module automatically pulls in the [Silverstripe ZenValidator](https://github.com/sheadawson/silverstripe-zenvalidator) module, since it adds new constraints.

- [Milkyway\\SS\\ZenForms\\Constraints\\RequiredIf](docs/en/constraints/RequiredIf.md)
- [Milkyway\\SS\\ZenForms\\Constraints\\ValidPassword](docs/en/constraints/ValidPassword.md)
- [Milkyway\\SS\\ZenForms\\Constraints\\ConfirmPassword](docs/en/constraints/ConfirmPassword.md)
- [Milkyway\\SS\\ZenForms\\Constraints\\Multiple](docs/en/constraints/Multiple.md)

ConfirmedPasswordField
----------------------

[](#confirmedpasswordfield)

When you wrap the ConfirmedPasswordField, it allows you to use the password measure helper and password generator. It only works properly when wrapped with the FormFieldBootstrapper though, and you must include jquery.complexify.js in your scripts for it to work (it is not included with the module).

License
-------

[](#license)

- MIT

Version
-------

[](#version)

- Version 0.2 (Alpha)

Contact
-------

[](#contact)

#### Milkyway Multimedia

[](#milkyway-multimedia)

- Homepage:
- E-mail:
- Twitter: [@mwmdesign](https://twitter.com/mwmdesign "mwmdesign on twitter")

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity53

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

3851d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/873db53f59bc2f8309c506d1b56313b0c7d8c7b3160eb1700ee0754d060f9767?d=identicon)[mi3ll](/maintainers/mi3ll)

---

Top Contributors

[![mellm0](https://avatars.githubusercontent.com/u/229937?v=4)](https://github.com/mellm0 "mellm0 (7 commits)")

---

Tags

bootstrapFormsmwm

### Embed Badge

![Health badge](/badges/milkyway-multimedia-ss-zen-forms/health.svg)

```
[![Health](https://phpackages.com/badges/milkyway-multimedia-ss-zen-forms/health.svg)](https://phpackages.com/packages/milkyway-multimedia-ss-zen-forms)
```

###  Alternatives

[unclecheese/bootstrap-forms

Allows you to create forms in SilverStripe that are compatible with Twitter Bootstrap.

5539.4k](/packages/unclecheese-bootstrap-forms)[contributte/forms-bootstrap

Nette extension for Bootstrap forms

211.1M4](/packages/contributte-forms-bootstrap)[nepada/form-renderer

Latte template based form renderer for Nette forms with full support for Bootstrap 3, 4 &amp; 5.

11251.0k](/packages/nepada-form-renderer)[metalogico/laravel-formello

A Laravel package for generating Bootstrap 5 and Tailwind CSS 4 forms based on models

1012.2k](/packages/metalogico-laravel-formello)[galahad/bootforms

Form builder with Bootstrap-specific conveniences. Remembers old input, retrieves error messages and handles all your boilerplate Bootstrap markup automatically.

1161.6k](/packages/galahad-bootforms)[rywa/silverstripe-foundation-forms

Add ZURB Foundation framework forms compatibility to SilverStripe 3

126.4k](/packages/rywa-silverstripe-foundation-forms)

PHPackages © 2026

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