Skip to content

Apart from being the base to all other gourmet plugins, this plugin extends some of the CakePHP core functionality (i.e. full support of logging scopes, more complete base test case, better app configuration, etc.).

License

gourmet/common

Repository files navigation

CakePHP Common Plugin

Built to help quickly putting together CakePHP applications.

Apart from being the base to all other gourmet plugins, this plugin extends some of the CakePHP core functionality (i.e. full support of logging scopes, more complete base test case, better app configuration, etc.).

Features

Behaviors

  • Authorizable: Controls access to records.

  • Commentable: Adds comments to records.

  • Computable: Computes total or average similarly to the CakePHP's counterCache.

  • Confirmable: Adds isConfirmed() validation rule.

  • Detailable: Extends any record with extra details.

  • Duplicatable: Duplicates any record to another model's table.

  • Encodable: Encodes array values in records for storing.

  • Filterable: Filters out any field from both, the find() resultset and save() result.

  • Stateable: Adds status type of field to records.

Components

Helpers

  • Asset: Controls asset inclusions (works well with AssetCompress).

  • Navigation: Renders navigations.

  • Stateable: Adds status type of selection list.

  • Table: Creates table for displaying result sets, with pagination support.

Install

Composer package

First, add this plugin as a requirement to your composer.json:

{
	"require": {
		"cakephp/common": "*"
	}
}

And then update:

php composer.phar update

That's it! You should now be ready to start configuring your channels.

Submodule

$ cd /app
$ git submodule add git://github.com/gourmet/common.git Plugin/Common

Clone

$ cd /app/Plugin
$ git clone git://github.com/gourmet/common.git

Configuration

You need to enable the plugin your app/Config/bootstrap.php file:

CakePlugin::load('Common', array('bootstrap' => true, 'routes' => true));

If you are already using CakePlugin::loadAll();, then this is not necessary.

Replace app/Console/Command/AppShell.php with the following:

<?php
App::uses('CommonAppShell', 'Common.Console');
class AppShell extends CommonAppShell {}

Replace app/Controller/AppController.php with the following:

<?php
App::uses('CommonAppController', 'Common.Controller');
class AppController extends CommonAppController {}

Replace app/Model/AppModel.php with the following:

<?php
App::uses('CommonAppModel', 'Common.Model');
class AppModel extends CommonAppModel {}

Replace app/View/Helper/AppHelper.php with the following:

<?php
App::uses('CommonAppHelper', 'Common.View/Helper');
class AppHelper extends CommonAppHelper {}

Patches & Features

  • Fork
  • Mod, fix
  • Test - this is important, so it's not unintentionally broken
  • Commit - do not mess with license, todo, version, etc. (if you do change any, bump them into commits of their own that I can ignore when I pull)
  • Pull request - bonus point for topic branches

Bugs & Feedback

http://github.com/gourmet/common/issues

License

Copyright 2013, Jad Bitar

Licensed under The MIT License
Redistributions of files must retain the above copyright notice.

About

Apart from being the base to all other gourmet plugins, this plugin extends some of the CakePHP core functionality (i.e. full support of logging scopes, more complete base test case, better app configuration, etc.).

Resources

License

Stars

Watchers

Forks

Packages

No packages published