PHPackages                             jameswatts/cake-factory - 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. jameswatts/cake-factory

ActiveCakephp-plugin[Utility &amp; Helpers](/categories/utility)

jameswatts/cake-factory
=======================

Cake is a factory for the Cake Toolkit (CTK) which provides configurable objects for the core helpers in CakePHP

91.4k5PHP

Since Oct 26Pushed 12y ago2 watchersCompare

[ Source](https://github.com/jameswatts/cake-factory)[ Packagist](https://packagist.org/packages/jameswatts/cake-factory)[ RSS](/packages/jameswatts-cake-factory/feed)WikiDiscussions beta Synced 3w ago

READMEChangelogDependenciesVersions (2)Used By (0)

Cake Factory
============

[](#cake-factory)

**Cake** is a *CakePHP* plugin which provides an additional factory for the **Cake Toolkit** (CTK), adding configurable objects for the core **Html** and **Form** helpers available with the framework.

The inclusion of an object-oriented interface for the core helpers allows for a more sophisticated usage, such as adding child nodes and binding events, as well as improving the overall level of abstraction and separation of concerns in the View layer.

Requirements
------------

[](#requirements)

- CakePHP 2+
- PHP 5.3+
- Cake Toolkit ()

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

[](#installation)

To use the plugin simply include it in your application's "app/Plugin" directory, and load it in the "app/Config/bootstrap.php" file.

```
CakePlugin::load('CakeFactory');
```

The above code is *not* required if you're already using `CakePlugin::loadAll()` to load all plugins.

Implementation
--------------

[](#implementation)

Once the plugin is available it's ready to use in your **CTK** Views, or with the **Factory** helper included with the **Cake Toolkit**. To include the **Cake** factory in a View just add the factory to your *$factories* collection, for example:

```
public $factories = array('CakeFactory.Cake');
```

With the factory now available you can call it in your View, and build your application using the **Html** and **Form** helpers via an object-oriented interface.

Here's a simple example of creating a **link** from the **Html** helper:

```
$this->Cake->Link(array(
	'title' => __('Read more'),
	'url' => array(
		'controller' => 'Posts',
		'action' => 'view',
		$postId
	)
));
```

Another example, creating a **form** with an **input** from the **Form** helper, with the additional binding of an **event** to the input element:

```
// create a CakePHP form
$form = $this->Cake->Form(array(
	'model' => 'Example',
	'options' => array(
		'action' => 'add'
	)
));
	// create a CakePHP input
	$input = $this->Cake->Input(array(
		'field' => 'Example.column',
		'options' => array(
			'type' => 'text'
		)
	));
	// bind an event to the input
	$input->bind('keyup', $this->Js->Alert(array(
		'code' => $this->Js->Element(array('node' => $input))->getValue()
	)));
// add the input to the form
$form->add($input);
// add the form to the view
$this->add($form);
```

Documentation
-------------

[](#documentation)

The **Cake** factory has been designed to follow the existing methods and arguments defined in the *CakePHP* core helpers. This allows for an easy transition to using the factory, as you'll already be familiar with the parameters expected. The documentation for each helper class can be found here:

- **HtmlHelper:**
- **FormHelper:**

There have been some modifications to parameter names compared to their equivalent arguments. This is almost always the case for arguments which are composed of *2* or more words, such as the *$fieldName* argument, which becomes just the *field* parameter.

Support
-------

[](#support)

For support, bugs and feature requests, please use the [issues](https://github.com/jameswatts/cake-factory/issues) section of this repository.

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

[](#contributing)

If you'd like to contribute new features, enhancements or bug fixes to the code base just follow these steps:

- Create a [GitHub](https://github.com/signup/free) account, if you don't own one already
- Then, [fork](https://help.github.com/articles/fork-a-repo) the [Cake](https://github.com/jameswatts/cake-factory) factory repository to your account
- Create a new [branch](https://help.github.com/articles/creating-and-deleting-branches-within-your-repository) from the *develop* branch in your forked repository
- Modify the existing code, or add new code to your branch, making sure you follow the [CakePHP Coding Standards](http://book.cakephp.org/2.0/en/contributing/cakephp-coding-conventions.html)
- Modify or add [unit tests](http://book.cakephp.org/2.0/en/development/testing.html) which confirm the correct functionality of your code (requires [PHPUnit](http://www.phpunit.de/manual/current/en/installation.html) 3.5+)
- Consider using the [CakePHP Code Sniffer](https://github.com/cakephp/cakephp-codesniffer) to check the quality of your code
- When ready, make a [pull request](http://help.github.com/send-pull-requests/) to the main repository

There may be some discussion reagrding your contribution to the repository before any code is merged in, so be prepared to provide feedback on your contribution if required.

A list of contributors to the **Cake** factory can be found [here](https://github.com/jameswatts/cake-factory/contributors).

Licence
-------

[](#licence)

Copyright 2013 James Watts (CakeDC). All rights reserved.

Licensed under the MIT License. Redistributions of the source code included in this repository must retain the copyright notice found in each file.

Acknowledgements
----------------

[](#acknowledgements)

Thanks to [Larry Masters](https://github.com/phpnut) and [everyone](https://github.com/cakephp/cakephp/contributors) who has contributed to [CakePHP](http://cakephp.org), helping make this framework what it is today.

###  Health Score

27

—

LowBetter than 47% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity23

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity43

Maturing project, gaining track record

 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.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/403296?v=4)[James Watts](/maintainers/jameswatts)[@jameswatts](https://github.com/jameswatts)

---

Top Contributors

[![jameswatts](https://avatars.githubusercontent.com/u/403296?v=4)](https://github.com/jameswatts "jameswatts (3 commits)")[![ajibarra](https://avatars.githubusercontent.com/u/794722?v=4)](https://github.com/ajibarra "ajibarra (1 commits)")[![skie](https://avatars.githubusercontent.com/u/130799?v=4)](https://github.com/skie "skie (1 commits)")

### Embed Badge

![Health badge](/badges/jameswatts-cake-factory/health.svg)

```
[![Health](https://phpackages.com/badges/jameswatts-cake-factory/health.svg)](https://phpackages.com/packages/jameswatts-cake-factory)
```

###  Alternatives

[dantleech/fink

Checks Links

2266.5k2](/packages/dantleech-fink)[maantje/pulse-php-fpm

A Laravel Pulse card to show php-fpm status

46142.1k](/packages/maantje-pulse-php-fpm)[bitrix-expert/bbc-module

Module with classes for the basis components

1952.0k1](/packages/bitrix-expert-bbc-module)

PHPackages © 2026

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