TipLite Keep It Simple Smart

12Feb/1028

CakePHP support in NetBeans

NetBeans is a very powerful development environment for many languages including PHP. With the release of its latest version, NetBeans announced full support for symfony PHP framework. NetBeans can also support many other PHP frameworks and libraries although it is not officially supported by NetBeans. This support needs some effort to enable some tools specially auto-complete, or intellisense, which saves a lot of time for developers.

We will start to make NetBeans support CakePHP. Firstly we need to create a cake project using cake command line tools.

1Dec/092

Easy HTTP Authentication using CakePHP 1.2

CakePHP 1.2 has HTTP basic authentication added to Security component which can be added to the controller using the following line in code in the following line of code

var $components = array('Security',);

To use the HTTP basic authentication you should add those lines to the action you want to restrict access:

    $this->Security->options = array('type' => 'basic', 'realm' => 'Restricted Area');
    $this->Security->loginUsers = array('user1' => 'password1', 'user2' => 'password2');
    $this->Security->requireLogin();

Realm option can be any description to the area where you want restriction. This can be any string you want. The option for 'loginUsers' is an array which the keys are user names and values are passwords.