Friday, April 15, 2011

Two Important CakePHP Plugins You Must Use In Your Next Cake Project - ACL Plugin & Facebook Plugin

I am glad to get personal emails from a few of our readers. They are mostly Cake Newbies! I am really excited to find that this blog has helped some of them. I promised to share two more plugins, which is a must have in your next Cake Project. The first one will make your life happy (if you use Auth component for authorization) and the second one will make your client happy (if he has strong facebook love!) . These two plugins are:

1) ACL plugin
2) facebook plugin

As you might know, it is easy to install plugins. Download necessary files, save them under /app/plugins/plugin-name/ folder. If it needs any extra database table, fire your SQL query editor. Usually, necessary table structures are included with the plugin package. Your tables should be ready within a few seconds. Next check for a few configuration files. You can find this file under:

/app/plugins/your-plugin-name/config/config.php

READ & FOLLOW the installation direction for your new plugin verbatim. Do not skip any single character. Most of the time, I messed things up because I really skipped a few words. The cakeMagic works when you follow the conventions. So, read the instructions and follow it. Make necessary changes to set your settings. If you do everything okay, it should be ready for use within 10- 20 minutes. A single error on your part can lead to lot of frustrating hours.

Regarding these two plugins here is what I think.

ACL plugin: Well those using Auth Component might be aware of the fact that CakePHP has a built-in mechanism to set user-level access control to various pages (/controllers/action/) of your website. ACL plugin has a beautiful AJAX based GUI. You can create new ACO on the fly and set permissions.

For example, say, in your PostsController (posts_controller.php) you have created new action - 'post_by_user' (function post_by_user()). Now you want only registered users to view this section.  So, add a new ACO [Access control object, in this case post_by_user() under 'posts' controller.] ACL plugin allows you to create this new node. Now you can set group level or user specific permission using ACL component. I am just giving you a screen shot.



The facebook plugin is a cool cakePHP application. It displays facebook like button, facebook login options, facebook fan pages and many more. My simple tips are to wait for a few hours after you have installed this plugin for it to work properly. Remember you need to create your APP ID, API Key & Secret at facebook (Create Applications). It takes a few hours (in my case) to propagate. IN the meantime, your facebook login action won't work. So, do not loose your heart.

Once you have installed those plugins, you can access it using the following urls:

http://your-good-domain.com/plugin-name (if you are NOT using admin routing)
http://your-good-domain.com/admin/plugin-name (if you are using admin routing)

Remember installing and using cakePHP plugin is pretty simple. FOLLOW the steps accurately. You must not have any reason to become frustrated anymore. 
Happy Baking!

Links to downloads:

2 comments:

Nishant said...

nice one and very innovative.. thanks for sharing... PHP Developer

Unknown said...

Cakephp is really an amazing e commerce development platform. One must cakephp development for building applications for his business as cakephp development various benefits and features.