Skip to content
This repository has been archived by the owner. It is now read-only.
Go to file

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time


Kohana Demo Application

A simple demo application for those who learn best from simple, working sample code and want to see a sampling of Kohana features in action.


  • Reverse Routing
  • Templating with Kostache
  • Basic Auth, including the ability to manage users. A user has the 'login' role by default and can optionally be assigned the 'admin' role
  • Form validation, displaying default error messages for the following cases:
    • album name and artist not empty (values are now being trimmed before validation so name => ' ' will now fail)
    • album name and artist limited to 80 chars
    • album name must be unique for a given artist
    • (just using built-in validation for user authentication)
  • Custom application error messages
  • ORM with MySQL database
  • Email notification using Swiftmailer (this requires an email server, but if you don't have one, it's OK -- the application won't break)
  • Fetching of album information from (cached using Fragment) (now AJAX-ified)
  • Album listing as XML via uri: album/listxml
  • Filtering, sorting and pagination performed server-side.


###Installing Files Using Git (Recommended)

  • create a directory
  • open a git bash there
  • $ git clone git:// .
  • $ git fetch
  • $ git submodule update --init --recursive It's a good idea to watch for errors during this step. I've occasionally seen 'fatal: unable to connect a socket (Invalid Argument). If you see something like that, I'd just blow away the directory and start over.

For more information on Git, see the Kohana Git Tutorial

###Installing Files Without Git


  • Make sure the application/cache and application/logs directories have write access.
  • Rename the example.htaccess included with this application to .htaccess and edit the RewriteBase to match your installation directory. For more information see here
  • Leave the line SetEnv KOHANA_ENV development as is for now. Later you can change it to production to use the custom error handler.
  • Rename application/example.bootstrap.php to bootstrap.php and set base_url to match your installation directory.
  • Check that the following modules are enabled in bootstrap.php: auth, orm, database, kostache, email
  • Rename application/config/example.auth.php to auth.php and edit it, setting the hash_key to a random string of your choice.
  • Create a mysql database
  • Rename the application/config/example.database.php to database.php and edit the 'default' section to match the hostname, database and username for the mysql database you created
  • Execute the schema in initial_schema.sql in your mysql datase.
  • If you want to enable album information from,
    • Sign up for a free api key at Web Services,
    • rename the application/config/example.lastfm.php to lastfm.php and
    • edit that file to set the api_key.
  • If you're installing to a live server and want to test email notification about a primary user being deleted or having their password changed,
    • enable the email module by un-commenting the line in application/bootstrap.php,
    • rename aplication/config/ to email.php and
    • edit that file to set the 'to' and 'from' email addresses.

You should be good to go. The default admin login is:

  • username: administrator
  • password: admin12345

but you can add a new administrator and delete that one if you like.

If you're working in a Windows (WAMP Server) environment, you may also find these useful:

See Also

For a much more elaborate example of the capabilities of the Auth module and loads of other useful information, I would recommend


I've borrowed heavily from several sources, including the Kohana site itself and the Unofficial Kohana 3 Wiki site but one other source should probably be mentioned:

Kohana: The Swift PHP Framework This was a Kohana 2 tutorial and its code bears almost no resemblance to that of this project, but I borrowed its simple schema and button images.


A demo application for Kohana (3.1.2 - 3.2)



No releases published


No packages published
You can’t perform that action at this time.