22 June 2010 ~ Comments Off

Nice Dog Framework

I just came across this mico php framework a few nights ago. When i say “micro” i mean micro, this framework is one file! Below is a sample using controllers and routes:

1
2
3
4
5
6
7
8
require 'NiceDog.php';
R('')->controller('MyController')->action('index')->on('GET');
class MyController extends C {
    function index(){
        echo $this->render('views/index.php');
    }
}
run();

You can now access the above by using http://local/mycontroller/

You may also add layouts to the mix by using:

$this->layout= "MyLayout.php";

To allow the routes to work, you will need to add the following to your vhosts or .htaccess file.

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]
</IfModule>

So if your looking for a mico php framework you may want to checkout Nice Dog.

Tags:

Comments are closed.