Home > cakephp-plugin-configurator

cakephp-plugin-configurator

Cakephp-plugin-configurator is a project mainly written in PHP, based on the MIT license.

⛔ [DEPRECATED] CakePHP Plugin for easy database managed site-wide configurations

CakePHP Configurator plugin

The Configurator plugin is an extremely useful way to store site-wide configuration. It stores configuration into your database and is made available throughout your site (views, controllers, models, tasks, etc.)

Installation and usage

First download or checkout the code for the Configurator and put it in your app/plugins directory. The directory structure should look like this:

/app
   /plugins
      /configurator
         /config
         /controllers
         /models
         /views

Create the database table either by running

$ cd your_app_directory
$ cake schema create -plugin configurator

or importing the configurator/config/schema.sql file. That will create the configurations database table.

Add the Configurator.Configure to the $components in the AppController:

...
var $components = array('Configurator.Configure');
...

If you wish to use the web front-end to change the configuration, make sure admin routing prefix is enabled in the app/config/core.php

...
Configure::write('Routing.prefixes', array('admin'));
...

and go to _YOURSITE/admin/configurator/configurations in your browser.

Create some keys, for example: Site.title. After they're saved, you can read them from anywhere inside the application using the Configure::read($key) method.

...
<title>
   <?php echo Configure::read('Site.title'); ?> -
   <?php echo $title_for_layout; ?>
</title>
...

Note

By default, the creation of the following keys and sub-keys is not possible because it might be risky and/or unpredictable: debug, log, App, Routing, Cache, Session, Security, Asset and Acl. If you wish to be able to create/modify them, change the configurator/models/configuration.php accordingly.

CakePHP 1.2 users

The plugins should work for you too but you'll have to use the views from the cake-1.2 branch.

Licence

Released under The MIT License

Credits

Inspired by CakePHP Configuration Plugin by Nick Baker