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

ActiveCakephp-plugin[Templating &amp; Views](/categories/templating)

jameswatts/cake-toolkit
=======================

Define your View as a class, providing a powerful object-oriented factory interface to dynamically build your CakePHP application UI with configurable objects

483.3k

Since Oct 26Compare

[ Source](https://github.com/jameswatts/cake-toolkit)[ Packagist](https://packagist.org/packages/jameswatts/cake-toolkit)[ RSS](/packages/jameswatts-cake-toolkit/feed)WikiDiscussions Synced today

READMEChangelogDependenciesVersions (2)Used By (0)

Cake Toolkit (CTK)
==================

[](#cake-toolkit-ctk)

The **Cake Toolkit** is a *CakePHP* plugin designed for medium-to-large scale web applications which require a scalable and standard solution to handling Views.

The plugin allows Views to be defined as a class, providing a powerful object-oriented factory interface to dynamically build your application's UI with configurable objects.

The main features of the plugin include:

- **Object-Oriented Design:** Every UI element is defined and manipulated as an object, giving you maximum control over the development of your View, by limiting your work to the semantic definition of the interface.
- **Abstraction and Encapsulation:** The ability to define a View as a native *PHP* class unlocks the potential of the native object-oriented features of the language, allowing Views to be extended, blocks of content to be abstracted, and view logic to be encapsulated in helper methods.
- **Separation of Concerns:** The design of the plugin provides a clear and coherent separation of the languages implicated in your development, such as *PHP*, *HTML*, *CSS* and *JavaScript*, making it easy to delegate experts in their field to the relevant areas, without having to work around code they're not familiar with.
- **Extensible Architecture:** Allowing collections of UI elements to be packaged into factories makes it easy to, not only extend the existing factories but, also create your own, tailored to your requirements.
- **Plug and Play:** The functionality of the plugin only adds to the current features available in *CakePHP*, making it possible for **CTK** Views to work along-side normal static ".ctp" Views.
- **Legacy Features:** Great care has been taken to maintaining the availability of the standard features for Views available in *CakePHP*, such as *layouts*, *elements*, *content blocks* and *helpers*.

To start using the **Cake Toolkit** it's as simple as including the plugin in your application, and then extending the *CtkAppController* to inherit everything you'll need, for example:

```
class ExampleController extends CtkAppController {

	public function index() {
		// action logic
	}
}
```

Or, alternatively, using the *AppComponent* for existing controllers, which also allows you to *ignore* specific actions to continue using normal ".ctp" views:

```
public $components = array(
	'Ctk.App' => array(
		'ignoreAction' => array('example') // allow "example" action to continue using "example.ctp"
	)
);
```

You can then define your View as a class, and build your UI using the objects made available through the included factories, without requiring extensive knowledge of the underlying technologies, for example:

```
class IndexView extends CtkView {

	public $factories = array('Ctk.Html', 'Ctk.Js');

	public function build() {
		// create a HTML div
		$div = $this->Html->Div();
			// create a HTML button
			$button = $this->Html->Button(array(
				'value' => __('Click Me')
			));
			// bind an event to the button
			$button->bind('click', $this->Js->Alert(array(
				'text' => __('Hello World')
			)));
		// add the button to the div
		$div->add($button);
		// add the div to the view
		$this->add($div);
	}
}
```

This file is saved as "IndexView.php" in a sub-directory of your View directory called `/Ctk`. This helps maintain your class files separate from your normal ".ctp" Views. So the path to your View class would be:

```
app/View/Example/Ctk/IndexView.php

```

It's also possible to use the special *Factory* helper to import objects from the **Cake Toolkit** into normal static ".ctp" Views, bringing the power of the plugin to your existing front-end code.

```
public $helpers = array(
	'Ctk.Factory' => array(
		'factories' => array('Ctk.Html', 'Ctk.Css')
	)
);
```

You can then use the objects within your markup, similar to when using the HTML helper, for example:

```

```

The output includes additional information about the request and response, as well as the performance statistics also present in the **Ctk-Info** header.

Apart from this, the usual *CakePHP* debugging options remain available, such as logs, the **debug()** function and the **Debugger** class.

Support
-------

[](#support)

For support, bugs and feature requests, please use the [issues](https://github.com/jameswatts/cake-toolkit/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 Toolkit](https://github.com/jameswatts/cake-toolkit) 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 regarding 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 Toolkit** can be found [here](https://github.com/jameswatts/cake-toolkit/contributors).

Licence
-------

[](#licence)

Copyright 2012-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)

A special thanks to [Larry Masters](https://github.com/phpnut), the founder of [CakePHP](http://cakephp.org), for his help and support, to [José Lorenzo](https://github.com/lorenzo) for his input early on when I was hacking the framework, to [Florian Krämer](https://github.com/burzum) for his constructive criticism, as well as the entire [CakeDC](http://cakedc.com) team for their feedback and encouragement.

###  Health Score

26

—

LowBetter than 40% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity26

Limited adoption so far

Community2

Small or concentrated contributor base

Maturity43

Maturing project, gaining track record

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)

### Embed Badge

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

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

###  Alternatives

[limenius/react-bundle

Client and Server-side react rendering in a Symfony Bundle

3841.2M](/packages/limenius-react-bundle)[pdewit/nova-external-url

An external URL Laravel Nova field.

30383.2k](/packages/pdewit-nova-external-url)[wbrowar/guide

A CMS Guide for Craft CMS.

6154.7k1](/packages/wbrowar-guide)

PHPackages © 2026

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