8. Example application
In this section we'll describe how to setup a new music-sharing application from scratch. We'll assume that Buan has already been installed and will use the following folder locations:
# Buan installation folder /usr/local/buan # Application folder /home/me # Application's document root /home/me/public_html
And we want the following features:
- Clean URLs without a prefix (the default behaviour)
- The application should be run entirely within a sub-folder ("eg-app") on the domain
- A MySQL database will be used for persistent storage of Models
5.1 Directory layout
/home/me /config /controllers /models /managers /public_html /eg-app /css /img /js /views
5.2 Configuration
<?php /* /home/me/config/app.php */ /* Global config*/ Config::set('app.command.urlPrefix', ''); // Empty for our uber-clean URLs Config::set('app.command.parameter', 'do'); Config::set('app.command.default', '/home'); Config::set('app.dir.controllers', dirname(dirname(__FILE__)).'/controllers'); Config::set('app.dir.models', dirname(dirname(__FILE__)).'/models'); Config::set('app.dir.modelManagers', dirname(dirname(__FILE__)).'/models/managers'); Config::set('app.dir.extensions', dirname(dirname(__FILE__)).'/extensions'); Config::set('app.dir.ignored', array('.', '..', '.svn', 'cvs')); Config::set('app.docRoot', dirname(dirname(__FILE__))); Config::set('app.domain', "www.my-domain.net"); Config::set('app.extensions', array()); Config::set('app.password', 'a-secure-password'); Config::set('app.urlRoot', '/eg-app'); // Name of the sub-folder in which the application will run /* Database */ Database::addConnection(array( 'name'=>'default', 'driver'=>'mysql', 'host'=>'localhost', 'database'=>'eg_app', 'username'=>'root', 'password'=>'' )); /* Model relationships */ ModelRelation::define(); ?>